From patchwork Mon Jun 22 23:52:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 6658401 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 32598C05AC for ; Mon, 22 Jun 2015 23:53:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B99E203C0 for ; Mon, 22 Jun 2015 23:53:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 146AF20412 for ; Mon, 22 Jun 2015 23:53:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z7BWi-0002xl-0o; Mon, 22 Jun 2015 23:53:20 +0000 Received: from mail-ig0-x22d.google.com ([2607:f8b0:4001:c05::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z7BWf-0002qn-Kd for linux-rockchip@lists.infradead.org; Mon, 22 Jun 2015 23:53:18 +0000 Received: by igboe5 with SMTP id oe5so76052118igb.1 for ; Mon, 22 Jun 2015 16:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/cNog8gi41suT/T/qZlmMQm1/i097zXFFU7oec0AC7M=; b=MYMk+qu4nJNEzAwhdc5ud6nLmXHSufcDQf2hrZtyE/w3p+NHh3vJ5d12FwK/vH4iaM gwi5fb0KvY1F+Zy0x/we1ocbp2raVpnseh2pzzMAZk7uqlJTmA22pLQVF0NGlKuuP6B/ mQKc1FD3W5BxeyVKtbWr3kp1syvStlWdDcU4U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/cNog8gi41suT/T/qZlmMQm1/i097zXFFU7oec0AC7M=; b=NXYhJUrdktgWZ0EOgImgoXkTZLnr3CyTmndRRDBQsjTjk9xVGceUtZZjOJ4NvhyFYn KvnEKwR3NX/uw/mIpnKxU6Ys3VwmgD1/juBYc6ugz3s1gXFSGffU8oAH4xFCt51Ni6I9 wU2uFvsgbKyfVuUblYhNS+TX77kPXw33649+UT7Wd8EC+sPdz/9o/eH13lc5BXQy5M9S XyerYvHMzkKtoprW16j6rFgg0M4wPOZN3SF7+KdJiAxR6IgH1TA4uiAX7uSu8u4x7qIo 683zOMcDdiGLn6u74t7APmbCBwy841D5FGmeN14e7z1xr6YxdOpPaGHnFFtAzBTjw+rb iVFw== X-Gm-Message-State: ALoCoQnJ3HHCg38gMq2IcN94vkaE3/0NfbrSAvvsjRsZ+Hd1kBCfihgar+mg4dWZs7cUSXyVI4rW X-Received: by 10.107.137.42 with SMTP id l42mr41294020iod.60.1435017175644; Mon, 22 Jun 2015 16:52:55 -0700 (PDT) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by mx.google.com with ESMTPSA id pg5sm8600390igb.4.2015.06.22.16.52.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Jun 2015 16:52:55 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , John Youn , Felipe Balbi Subject: [PATCH 1/3] USB: Export usb_wakeup_enabled_descendants() Date: Mon, 22 Jun 2015 16:52:22 -0700 Message-Id: <1435017144-2971-2-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef In-Reply-To: <1435017144-2971-1-git-send-email-dianders@chromium.org> References: <1435017144-2971-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150622_165317_732391_2D7C6C86 X-CRM114-Status: GOOD ( 12.24 ) X-Spam-Score: -2.7 (--) Cc: Robert Schlabbach , linux-usb@vger.kernel.org, Heiko Stuebner , Andrew Bresticker , Pratyush Anand , Matthew Garrett , Douglas Anderson , Petr Mladek , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Alan Stern , lyz@rock-chips.com, Peter Chen , Chris Zhong , Julius Werner , Dan Williams , Zhuang Jin Can , Alexandru Stan X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In (e583d9d USB: global suspend and remote wakeup don't mix) we introduced wakeup_enabled_descendants() as a static function. We'd like to use this function in USB controller drivers to know if we should keep the controller on during suspend time, since doing so has a power impact. Signed-off-by: Douglas Anderson --- drivers/usb/core/hub.c | 7 ++++--- include/linux/usb/hcd.h | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 43cb2f2..fdc59db 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3034,13 +3034,14 @@ static int usb_disable_remote_wakeup(struct usb_device *udev) } /* Count of wakeup-enabled devices at or below udev */ -static unsigned wakeup_enabled_descendants(struct usb_device *udev) +unsigned usb_wakeup_enabled_descendants(struct usb_device *udev) { struct usb_hub *hub = usb_hub_to_struct_hub(udev); return udev->do_remote_wakeup + (hub ? hub->wakeup_enabled_descendants : 0); } +EXPORT_SYMBOL_GPL(usb_wakeup_enabled_descendants); /* * usb_port_suspend - suspend a usb device's upstream port @@ -3149,7 +3150,7 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) * Therefore we will turn on the suspend feature if udev or any of its * descendants is enabled for remote wakeup. */ - else if (PMSG_IS_AUTO(msg) || wakeup_enabled_descendants(udev) > 0) + else if (PMSG_IS_AUTO(msg) || usb_wakeup_enabled_descendants(udev) > 0) status = set_port_feature(hub->hdev, port1, USB_PORT_FEAT_SUSPEND); else { @@ -3548,7 +3549,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) } if (udev) hub->wakeup_enabled_descendants += - wakeup_enabled_descendants(udev); + usb_wakeup_enabled_descendants(udev); } if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) { diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index c9aa779..30d74c9 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -626,11 +626,16 @@ extern wait_queue_head_t usb_kill_urb_queue; #define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN)) #ifdef CONFIG_PM +extern unsigned usb_wakeup_enabled_descendants(struct usb_device *udev); extern void usb_root_hub_lost_power(struct usb_device *rhdev); extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg); extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); #else +static inline unsigned usb_wakeup_enabled_descendants(struct usb_device *udev) +{ + return 0; +} static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) { return;