From patchwork Mon Jul 6 18:27:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 6727091 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 46388C05AC for ; Mon, 6 Jul 2015 18:28:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A9EB20430 for ; Mon, 6 Jul 2015 18:27:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67BAE202F0 for ; Mon, 6 Jul 2015 18:27:58 +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 1ZCB7W-0005do-5W; Mon, 06 Jul 2015 18:27:58 +0000 Received: from mail-ie0-x22d.google.com ([2607:f8b0:4001:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCB7U-0005bS-Ew for linux-rockchip@lists.infradead.org; Mon, 06 Jul 2015 18:27:57 +0000 Received: by ieqy10 with SMTP id y10so119403704ieq.0 for ; Mon, 06 Jul 2015 11:27:35 -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=cYEVPhDTuPrhvFLBzXq7ta8V/HmnfHOhkpq0Prlxej4al2IdLAMNaEFgZ+zC3sWCb6 G9paqGvYuTLyBtuy7AAK2U6JWdKstw+7Lx+4di/2GT7gIikBL50iaZhlSiy7h5JqMcWi /mJ4Za5MP9jH1t504avl7yM4d/4x3liGIx4RY= 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=VLF3rZMxMotTeX2t1Xx5p8rdUAGpyPpd0F7EZLpngyDORr7kfzJQyD0ah7pYhknb2Q dnwsazCBe+6ZpT0Jj/EwmHaA8AhYz5dAmLFht0fsajpWrHlu3s8uvUfatjwe1n0mRUzM I+fEbNkCpaGjbMxuiBEEbATi4Bw51fWtXjaJgTQ9RE2ca+8VIOEYerCHk37caHtSpxxY voCyG+rvh9gxqKk35XevwXFMrimkDOwBES8Vm79C3Pt1LGr2Wjuh8euGiEvAFw7E121e 8dzJu1eqMQ5ojjJTpV45S3GQW9mqEK7LztALbdSYoHdiC5lqmh5tOAzoFt7L5qh3TzBb BtqQ== X-Gm-Message-State: ALoCoQlfOE1yUiXyqWLMvrB/3Rw6xzwkHacHOIWl6/nsmUOyFP3cQPJTsNY3h/YX/ckz7UTOVHdX X-Received: by 10.50.138.76 with SMTP id qo12mr42588041igb.38.1436207255586; Mon, 06 Jul 2015 11:27:35 -0700 (PDT) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by smtp.gmail.com with ESMTPSA id o19sm10174850igi.14.2015.07.06.11.27.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jul 2015 11:27:35 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , John Youn , Felipe Balbi Subject: [REPOST PATCH 1/3] USB: Export usb_wakeup_enabled_descendants() Date: Mon, 6 Jul 2015 11:27:02 -0700 Message-Id: <1436207224-21849-2-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef In-Reply-To: <1436207224-21849-1-git-send-email-dianders@chromium.org> References: <1436207224-21849-1-git-send-email-dianders@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150706_112756_545724_6DAD1E2C X-CRM114-Status: GOOD ( 11.76 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Schlabbach , Pratyush Anand , Heiko Stuebner , Andrew Bresticker , linux-usb@vger.kernel.org, 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 , Alexandru Stan 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=-4.8 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;