USB: repair USBDEVFS_CONNECT ioctl
authorAlan Stern <stern@rowland.harvard.edu>
Mon, 3 Dec 2007 20:42:10 +0000 (15:42 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 Feb 2008 22:34:53 +0000 (14:34 -0800)
For as long as I've known about it, the USBDEVFS_CONNECT ioctl hasn't
done what it's supposed to.  The current code reprobes _all_ the
unbound USB interfaces; this patch (as1021) makes it reprobe only the
interface for which it was called.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/devio.c

index 1f4f6d02fe25598e22a62b785b1b7140913b7c12..85ec65ada123a5718d7ab1d889f4bd49c1e9d22c 100644 (file)
@@ -1373,9 +1373,10 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
 
        /* let kernel drivers try to (re)bind to the interface */
        case USBDEVFS_CONNECT:
-               usb_unlock_device(ps->dev);
-               retval = bus_rescan_devices(intf->dev.bus);
-               usb_lock_device(ps->dev);
+               if (!intf->dev.driver)
+                       retval = device_attach(&intf->dev);
+               else
+                       retval = -EBUSY;
                break;
 
        /* talk directly to the interface's driver */