Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751752AbbFOCwW (ORCPT ); Sun, 14 Jun 2015 22:52:22 -0400 Received: from mga02.intel.com ([134.134.136.20]:54807 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752691AbbFOCwJ (ORCPT ); Sun, 14 Jun 2015 22:52:09 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,615,1427785200"; d="scan'208";a="587800496" Message-ID: <557E3DD4.9080507@linux.intel.com> Date: Mon, 15 Jun 2015 10:52:04 +0800 From: "Lu, Baolu" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Alan Stern CC: Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/1] usb: core: lpm: set lpm_capable for root hub device References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2775 Lines: 73 On 06/13/2015 11:00 PM, Alan Stern wrote: > On Sat, 13 Jun 2015, Lu Baolu wrote: > >> Commit 25cd2882e2fc ("usb/xhci: Change how we indicate a host supports >> Link PM.") removed the code to set lpm_capable for USB 3.0 super-speed >> root hub. The intention of that change was to avoid touching usb core >> internal field, a.k.a. lpm_capable, and let usb core to set it by >> checking U1 and U2 exit latency values in the descriptor. >> >> Usb core checks and sets lpm_capable in hub_port_init(). Unfortunately, >> root hub is a special usb device as it has no parent. Hub_port_init() >> will never be called for a root hub device. That means lpm_capable will >> by no means be set for the root hub. As the result, lpm isn't functional >> at all in Linux kernel. >> >> This patch add the code to check and set lpm_capable when registering a >> root hub device. It could be back-ported to kernels as old as v3.15, >> that contains the Commit 25cd2882e2fc ("usb/xhci: Change how we indicate >> a host supports Link PM."). >> >> Cc: stable@vger.kernel.org # 3.15 >> Reported-by: Kevin Strasser >> Signed-off-by: Lu Baolu >> --- >> --- a/drivers/usb/core/usb.h >> +++ b/drivers/usb/core/usb.h >> @@ -82,6 +82,7 @@ extern int usb_runtime_suspend(struct device *dev); >> extern int usb_runtime_resume(struct device *dev); >> extern int usb_runtime_idle(struct device *dev); >> extern int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable); >> +extern int usb_device_supports_lpm(struct usb_device *udev); >> >> #else >> >> @@ -106,6 +107,11 @@ static inline int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) >> return 0; >> } >> >> +static inline int usb_device_supports_lpm(struct usb_device *udev) >> +{ >> + return 0; >> +} >> + >> #endif >> >> extern struct bus_type usb_bus_type; > In fact, usb_device_supports_lpm() is compiled even when CONFIG_PM > isn't set. Maybe this should be changed. But if you don't want to > change it now, you need to put the declaration outside the "#ifdef > CONFIG_PM" region. As it is, your patch is still broken (did you try > building it with CONFIG_PM unset?). I am sorry for this silly mistake. I will move it out of CONFIG_PM region. I tried building with CONFIG_PM unset. But it turns out that CONFIG_PM was auto selected by some other items. I will test my next version of patch with CONFIG_PM *really* unset before sending it out. Thanks, Baolu > > Alan Stern > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/