Re: [PATCH] USB Core hub.c

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Mon, 21 May 2007, David Brownell wrote:

> On Monday 21 May 2007, you wrote:
> > Hi David
> >  Can you check the following patch that may be needed in hub.c
> > Prevent un-necessary enumeration of 3 times when device is not there.
> > 
> > Signed-off-by: Vikram Pandita <[email protected]>
> 
> Looks sane to me, but this would be better sent to
> the linux-usb list...
> 
> > 
> > ---
> > diff -purN -X ./dontdiff a/drivers/usb/core/hub.c
> > b/drivers/usb/core/hub.c
> > --- a/drivers/usb/core/hub.c    2007-05-13 14:24:43.000000000 +0530
> > +++ b/drivers/usb/core/hub.c    2007-05-21 13:19:07.000000000 +0530
> > @@ -2571,7 +2571,7 @@ loop:
> >                 ep0_reinit(udev);
> >                 release_address(udev);
> >                 usb_put_dev(udev);
> > -               if (status == -ENOTCONN)
> > +               if ((status == -ENOTCONN) || (status == -ENODEV))
> >                         break;
> >         }

This is wrong.  -ENOTCONN means what it says, that nothing is connected 
to the port.  So when it occurs we really do want to break out of the 
loop.

On the other hand, -ENODEV means that there is a device but it doesn't 
match our preconceptions (maybe its speed has somehow changed or some 
other aspect is different).  Since there still is a device connected to 
the port, we don't want to break out of the loop.

Did you notice any particular example where the port was unconnected 
and the code still tried to enumerate three times?

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
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.