On Fri, Aug 11, 2006 at 11:24:26AM -0400, Alan Stern wrote:
> On Fri, 11 Aug 2006, Greg KH wrote:
> 
> > From: Greg Kroah-Hartman <[EMAIL PROTECTED]>
> > Subject: USB: create a new thread for every USB device found during the 
> > probe sequence
> > 
> > Might speed up some systems.  If nothing else, a bad driver should not
> > take the whole USB subsystem down with it.
> > 
> > Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
> > 
> > ---
> >  drivers/usb/core/hub.c |   14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> > 
> > --- gregkh-2.6.orig/drivers/usb/core/hub.c
> > +++ gregkh-2.6/drivers/usb/core/hub.c
> > @@ -1199,8 +1199,9 @@ static void show_string(struct usb_devic
> >   *
> >   * Only the hub driver or root-hub registrar should ever call this.
> >   */
> > -int usb_new_device(struct usb_device *udev)
> > +static int __usb_new_device(void *void_data)
> >  {
> > +   struct usb_device *udev = void_data;
> >     int err;
> >  
> >     err = usb_get_configuration(udev);
> > @@ -1311,6 +1312,17 @@ fail:
> >     return err;
> >  }
> >  
> > +int usb_new_device(struct usb_device *udev)
> > +{
> > +   struct task_struct *probe_task;
> > +   int ret = 0;
> > +
> > +   probe_task = kthread_run(__usb_new_device, udev,
> > +                            "usb-probe-%s", udev->devnum);
> > +   if (IS_ERR(probe_task))
> > +           ret = PTR_ERR(probe_task);
> > +   return ret;
> > +}
> >  
> >  static int hub_port_status(struct usb_hub *hub, int port1,
> >                            u16 *status, u16 *change)
> > 
> 
> This won't work right if an error occurs.  The value you return to the 
> caller of usb_new_device() reflects only errors in creating the new 
> thread.  It doesn't reflect any errors the thread itself may encounter.  
> 
> So the caller won't realize it if __usb_new_device() fails.

Yes, I realise this, but the callers of usb_new_device() don't always do
something "useful" with that information anyway, so it's not a real loss
here :)

thanks,

greg k-h

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to