Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1

70 views
Skip to first unread message

Roger Quadros

unread,
Aug 4, 2014, 5:50:01 AM8/4/14
to
If user specifies that USB autosuspend must be disabled by module
parameter "usbcore.autosuspend=-1" then we must prevent
autosuspend of USB hub devices as well.

commit 596d789a211d introduced in v3.8 changed the original behaivour
and stopped respecting the usbcore.autosuspend parameter for hubs.

Fixes: 596d789a211d "USB: set hub's default autosuspend delay as 0"

Cc: [3.8+] <sta...@vger.kernel.org>
Signed-off-by: Roger Quadros <rog...@ti.com>
---
drivers/usb/core/hub.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 0e950ad..a287cd5 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1728,8 +1728,12 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
* - Change autosuspend delay of hub can avoid unnecessary auto
* suspend timer for hub, also may decrease power consumption
* of USB bus.
+ *
+ * - If user has indicated to prevent autosuspend by passing
+ * usbcore.autosuspend = -1 then keep autosuspend disabled.
*/
- pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
+ if (hdev->dev.power.autosuspend_delay >= 0)
+ pm_runtime_set_autosuspend_delay(&hdev->dev, 0);

/*
* Hubs have proper suspend/resume support, except for root hubs
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Alan Stern

unread,
Aug 4, 2014, 10:10:01 AM8/4/14
to
On Mon, 4 Aug 2014, Roger Quadros wrote:

> If user specifies that USB autosuspend must be disabled by module
> parameter "usbcore.autosuspend=-1" then we must prevent
> autosuspend of USB hub devices as well.
>
> commit 596d789a211d introduced in v3.8 changed the original behaivour
> and stopped respecting the usbcore.autosuspend parameter for hubs.
>
> Fixes: 596d789a211d "USB: set hub's default autosuspend delay as 0"
>
> Cc: [3.8+] <sta...@vger.kernel.org>
> Signed-off-by: Roger Quadros <rog...@ti.com>

Acked-by: Alan Stern <st...@rowland.harvard.edu>

Michael Welling

unread,
Aug 4, 2014, 11:50:01 AM8/4/14
to
On Mon, Aug 04, 2014 at 12:44:46PM +0300, Roger Quadros wrote:
> If user specifies that USB autosuspend must be disabled by module
> parameter "usbcore.autosuspend=-1" then we must prevent
> autosuspend of USB hub devices as well.
>
> commit 596d789a211d introduced in v3.8 changed the original behaivour
> and stopped respecting the usbcore.autosuspend parameter for hubs.
>
> Fixes: 596d789a211d "USB: set hub's default autosuspend delay as 0"
>
> Cc: [3.8+] <sta...@vger.kernel.org>
> Signed-off-by: Roger Quadros <rog...@ti.com>

Tested-by: Michael Welling <mwel...@emacinc.com>

Roger Quadros

unread,
Aug 27, 2014, 6:40:03 AM8/27/14
to
On 08/04/2014 05:07 PM, Alan Stern wrote:
> On Mon, 4 Aug 2014, Roger Quadros wrote:
>
>> If user specifies that USB autosuspend must be disabled by module
>> parameter "usbcore.autosuspend=-1" then we must prevent
>> autosuspend of USB hub devices as well.
>>
>> commit 596d789a211d introduced in v3.8 changed the original behaivour
>> and stopped respecting the usbcore.autosuspend parameter for hubs.
>>
>> Fixes: 596d789a211d "USB: set hub's default autosuspend delay as 0"
>>
>> Cc: [3.8+] <sta...@vger.kernel.org>
>> Signed-off-by: Roger Quadros <rog...@ti.com>
>
> Acked-by: Alan Stern <st...@rowland.harvard.edu>
>

Just noticed the below error by the Intel's build script

> tree: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus
> head: 039368901ad0a6476c7ecf0cfe4f84d735e30135
> commit: bdd405d2a5287bdb9b04670ea255e1f122138e66 [19/20] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
> config: make ARCH=sparc64 defconfig
>
> All error/warnings:
>
> drivers/usb/core/hub.c: In function 'hub_probe':
>>> drivers/usb/core/hub.c:1735:21: error: 'struct dev_pm_info' has no member named 'autosuspend_delay'
> if (hdev->dev.power.autosuspend_delay >= 0)
> ^

Seems like the "if" has to be placed within a #ifdef CONFIG_PM_RUNTIME.

Greg,

Should I send a v2 of this patch or a fix on top of your usb-linus branch?

cheers,
-roger

Roger Quadros

unread,
Aug 27, 2014, 8:20:03 AM8/27/14
to
If user specifies that USB autosuspend must be disabled by module
parameter "usbcore.autosuspend=-1" then we must prevent
autosuspend of USB hub devices as well.

commit 596d789a211d introduced in v3.8 changed the original behaivour
and stopped respecting the usbcore.autosuspend parameter for hubs.

Fixes: 596d789a211d "USB: set hub's default autosuspend delay as 0"

Cc: [3.8+] <sta...@vger.kernel.org>
Signed-off-by: Roger Quadros <rog...@ti.com>
---
drivers/usb/core/hub.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 8a4dcbc..59b599d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1728,8 +1728,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
* - Change autosuspend delay of hub can avoid unnecessary auto
* suspend timer for hub, also may decrease power consumption
* of USB bus.
+ *
+ * - If user has indicated to prevent autosuspend by passing
+ * usbcore.autosuspend = -1 then keep autosuspend disabled.
*/
- pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
+#ifdef CONFIG_PM_RUNTIME
+ if (hdev->dev.power.autosuspend_delay >= 0)
+ pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
+#endif

Greg KH

unread,
Aug 27, 2014, 3:30:03 PM8/27/14
to
Sorry, but can I have a patch that just adds the #ifdef as I already
have your original one in my tree.

thanks,

greg k-h

Greg KH

unread,
Aug 27, 2014, 3:30:03 PM8/27/14
to
Please send a fix-on-top, as I already have your patch applied, and
can't remove it.

thanks,

greg k-h

Greg KH

unread,
Aug 27, 2014, 5:10:04 PM8/27/14
to
This should be all that is needed, right?

---------


diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 003cb6b1a6bf..46f5161c7891 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1732,8 +1732,10 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
* - If user has indicated to prevent autosuspend by passing
* usbcore.autosuspend = -1 then keep autosuspend disabled.
*/
+#ifdef CONFIG_PM_RUNTIME
if (hdev->dev.power.autosuspend_delay >= 0)
pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
+#endif

/*
* Hubs have proper suspend/resume support, except for root hubs

Roger Quadros

unread,
Aug 28, 2014, 6:00:02 AM8/28/14
to
Yes. Thanks Greg.

cheers,
-roger
0 new messages