Re: [PATCH] Correct autosuspend_delay for non-hubs.

Sarah Sharp <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <20070922163607.GA8437@localdomain>
On Sat, Sep 22, 2007 at 10:08:26AM -0400, Alan Stern wrote:
> On Fri, 21 Sep 2007, Sarah Sharp wrote:
> 
> > Without this patch, `cat /sys/bus/usb/devices/*/power/autosuspend` will return
> > 0 for any device that is not a hub.  This happens because of the integer divide
> > in show_autosuspend in sysfs.c
> > 
> > Signed-off-by: Sarah Sharp <[email protected]>
> > ---
> >  drivers/usb/core/quirks.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
> > index ebf3dc2..4a0e474 100644
> > --- a/drivers/usb/core/quirks.c
> > +++ b/drivers/usb/core/quirks.c
> > @@ -156,6 +156,6 @@ void usb_detect_quirks(struct usb_device *udev)
> >  	/* By default, disable autosuspend for all non-hubs */
> >  #ifdef	CONFIG_USB_SUSPEND
> >  	if (udev->descriptor.bDeviceClass != USB_CLASS_HUB)
> > -		udev->autosuspend_delay = -1;
> > +		udev->autosuspend_delay = -1 * HZ;
> >  #endif
> >  }
> 
> Amusingly, my patch as995 (submitted just a few minutes earlier) 
> already includes this change.

Yes, I was amused that they came in so close together. :)  Although I
think that setting autosuspend_disabled is a better solution.  Is there
any reason that autosuspend_delay should be set to -1?  The topic was
brought up before, but I never saw a response from Oliver.

Sarah

On Mon, Aug 20, 2007 at 12:28:13PM -0400, Alan Stern wrote:
> On Mon, 20 Aug 2007, Jean Delvare wrote:
> 
> > On Mon, 20 Aug 2007 10:00:26 -0400 (EDT), Alan Stern wrote:
> > > On Mon, 20 Aug 2007, Jean Delvare wrote:
> > > 
> > > > Hmm, maybe my question wasn't totally clear, let me rephrase. Shouldn't
> > > > sysfs reflect the fact that autosuspend is disabled for my device
> > > > somehow? When I read "2" from the autosuspend file, it gives me the
> > > > impression that autosuspend is enabled, and I think it's confusing.
> > > 
> > > There's a different sysfs attribute that gets set when autosuspend is 
> > > disabled.  The .../power/level attribute file can be set to "on", 
> > > "auto", or "suspend".
> > > 
> > > > (I thought that an autosuspend value of 0 meant that autosuspend was
> > > > disabled, but your reply make me understand that this isn't the case.
> > > > Sorry for the confusion.)
> > > 
> > > It was the case in 2.6.22, but in 2.6.23 0 means to autosuspend as soon 
> > > as possible.
> > 
> > Ah, OK, thanks for the clarification. But then isn't level=on redundant
> > with autosuspend=-1?
> 
> It is.  The intent was that the two attribute files could have 
> different permissions.  Oliver can explain it all.
> 
> Alan Stern

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG9UR3RqNbFWK10kwRAnqPAKCWcG6L1LyALUQ4m07rh7NBBtYGYACfTsyV
e8WUwr1E50u++EOfMhFnK6Y=
=nqiK
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.