USB: shutdown all URBs after controller death
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 17 Jul 2014 19:40:57 +0000 (15:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2014 23:59:27 +0000 (16:59 -0700)
When a host controller dies, we don't need to wait for a driver to
time out.  We can shut down its URBs immediately.  Without this
change, we can end up waiting 30 seconds for a mass-storage transfer
to time out.

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

index 4aeb10034de7c0db94333d66c4e98bf4df9052f5..9bffd26cea053c162e1b26abf9afd268d39d7967 100644 (file)
@@ -417,10 +417,11 @@ static int usb_unbind_interface(struct device *dev)
         */
        lpm_disable_error = usb_unlocked_disable_lpm(udev);
 
-       /* Terminate all URBs for this interface unless the driver
-        * supports "soft" unbinding.
+       /*
+        * Terminate all URBs for this interface unless the driver
+        * supports "soft" unbinding and the device is still present.
         */
-       if (!driver->soft_unbind)
+       if (!driver->soft_unbind || udev->state == USB_STATE_NOTATTACHED)
                usb_disable_interface(udev, intf, false);
 
        driver->disconnect(intf);