All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
@ 2014-08-04  9:44 Roger Quadros
  2014-08-04 14:07 ` Alan Stern
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Roger Quadros @ 2014-08-04  9:44 UTC (permalink / raw)
  To: gregkh, stern
  Cc: balbi, ming.lei, mwelling, stefan, linux-usb, linux-kernel,
	Roger Quadros, [3.8+]

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+] <stable@vger.kernel.org>
Signed-off-by: Roger Quadros <rogerq@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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
  2014-08-04  9:44 [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1 Roger Quadros
@ 2014-08-04 14:07 ` Alan Stern
  2014-08-27 10:31   ` Roger Quadros
  2014-08-04 15:45 ` Michael Welling
  2014-08-27 12:11 ` [PATCH v2] " Roger Quadros
  2 siblings, 1 reply; 9+ messages in thread
From: Alan Stern @ 2014-08-04 14:07 UTC (permalink / raw)
  To: Roger Quadros
  Cc: gregkh, balbi, ming.lei, mwelling, stefan, linux-usb,
	linux-kernel, [3.8+]

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+] <stable@vger.kernel.org>
> Signed-off-by: Roger Quadros <rogerq@ti.com>

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
  2014-08-04  9:44 [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1 Roger Quadros
  2014-08-04 14:07 ` Alan Stern
@ 2014-08-04 15:45 ` Michael Welling
  2014-08-27 12:11 ` [PATCH v2] " Roger Quadros
  2 siblings, 0 replies; 9+ messages in thread
From: Michael Welling @ 2014-08-04 15:45 UTC (permalink / raw)
  To: Roger Quadros
  Cc: gregkh, stern, balbi, ming.lei, stefan, linux-usb, linux-kernel, [3.8+]

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+] <stable@vger.kernel.org>
> Signed-off-by: Roger Quadros <rogerq@ti.com>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
  2014-08-04 14:07 ` Alan Stern
@ 2014-08-27 10:31   ` Roger Quadros
  2014-08-27 19:20     ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Roger Quadros @ 2014-08-27 10:31 UTC (permalink / raw)
  To: Alan Stern, gregkh
  Cc: balbi, ming.lei, mwelling, stefan, linux-usb, linux-kernel, [3.8+]

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+] <stable@vger.kernel.org>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
> 
> Acked-by: Alan Stern <stern@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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
  2014-08-04  9:44 [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1 Roger Quadros
  2014-08-04 14:07 ` Alan Stern
  2014-08-04 15:45 ` Michael Welling
@ 2014-08-27 12:11 ` Roger Quadros
  2014-08-27 19:23   ` Greg KH
  2 siblings, 1 reply; 9+ messages in thread
From: Roger Quadros @ 2014-08-27 12:11 UTC (permalink / raw)
  To: gregkh, stern
  Cc: balbi, ming.lei, mwelling, stefan, linux-usb, linux-kernel, [3.8+]

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+] <stable@vger.kernel.org>
Signed-off-by: Roger Quadros <rogerq@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
 
 	/*
 	 * Hubs have proper suspend/resume support, except for root hubs
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
  2014-08-27 10:31   ` Roger Quadros
@ 2014-08-27 19:20     ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2014-08-27 19:20 UTC (permalink / raw)
  To: Roger Quadros
  Cc: Alan Stern, balbi, ming.lei, mwelling, stefan, linux-usb,
	linux-kernel, [3.8+]

On Wed, Aug 27, 2014 at 01:31:24PM +0300, Roger Quadros wrote:
> 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+] <stable@vger.kernel.org>
> >> Signed-off-by: Roger Quadros <rogerq@ti.com>
> > 
> > Acked-by: Alan Stern <stern@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?

Please send a fix-on-top, as I already have your patch applied, and
can't remove it.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
  2014-08-27 12:11 ` [PATCH v2] " Roger Quadros
@ 2014-08-27 19:23   ` Greg KH
  2014-08-27 21:02     ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2014-08-27 19:23 UTC (permalink / raw)
  To: Roger Quadros
  Cc: stern, balbi, ming.lei, mwelling, stefan, linux-usb,
	linux-kernel, [3.8+]

On Wed, Aug 27, 2014 at 03:11:10PM +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+] <stable@vger.kernel.org>
> Signed-off-by: Roger Quadros <rogerq@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
>  
>  	/*
>  	 * Hubs have proper suspend/resume support, except for root hubs

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
  2014-08-27 19:23   ` Greg KH
@ 2014-08-27 21:02     ` Greg KH
  2014-08-28  9:52       ` Roger Quadros
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2014-08-27 21:02 UTC (permalink / raw)
  To: Roger Quadros
  Cc: stern, balbi, ming.lei, mwelling, stefan, linux-usb,
	linux-kernel, [3.8+]

On Wed, Aug 27, 2014 at 12:23:39PM -0700, Greg KH wrote:
> On Wed, Aug 27, 2014 at 03:11:10PM +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+] <stable@vger.kernel.org>
> > Signed-off-by: Roger Quadros <rogerq@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
> >  
> >  	/*
> >  	 * Hubs have proper suspend/resume support, except for root hubs
> 
> Sorry, but can I have a patch that just adds the #ifdef as I already
> have your original one in my tree.

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1
  2014-08-27 21:02     ` Greg KH
@ 2014-08-28  9:52       ` Roger Quadros
  0 siblings, 0 replies; 9+ messages in thread
From: Roger Quadros @ 2014-08-28  9:52 UTC (permalink / raw)
  To: Greg KH
  Cc: stern, balbi, ming.lei, mwelling, stefan, linux-usb,
	linux-kernel, [3.8+]

On 08/28/2014 12:02 AM, Greg KH wrote:
> On Wed, Aug 27, 2014 at 12:23:39PM -0700, Greg KH wrote:
>> On Wed, Aug 27, 2014 at 03:11:10PM +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+] <stable@vger.kernel.org>
>>> Signed-off-by: Roger Quadros <rogerq@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
>>>  
>>>  	/*
>>>  	 * Hubs have proper suspend/resume support, except for root hubs
>>
>> Sorry, but can I have a patch that just adds the #ifdef as I already
>> have your original one in my tree.
> 
> 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
> 

Yes. Thanks Greg.

cheers,
-roger

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-08-28  9:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-04  9:44 [PATCH] usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1 Roger Quadros
2014-08-04 14:07 ` Alan Stern
2014-08-27 10:31   ` Roger Quadros
2014-08-27 19:20     ` Greg KH
2014-08-04 15:45 ` Michael Welling
2014-08-27 12:11 ` [PATCH v2] " Roger Quadros
2014-08-27 19:23   ` Greg KH
2014-08-27 21:02     ` Greg KH
2014-08-28  9:52       ` Roger Quadros

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.