Commit dd4dd19e8d13e1e9bf8295bf71f132b511b130bf

Authored by Alan Stern
Committed by Greg Kroah-Hartman
1 parent 3c519b846c

USB: Make device reset stop retrying after disconnect

This patch (as898) changes the port reset code in the hub driver.  If
a connect change occurs, it is reported the same way as a disconnect
(which of course is what it really is).

It also changes usb_reset_device(), to prevent the routine from futilely
retrying the reset after a disconnect has occurred.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

drivers/usb/core/hub.c
... ... @@ -1539,9 +1539,9 @@
1539 1539 if (!(portstatus & USB_PORT_STAT_CONNECTION))
1540 1540 return -ENOTCONN;
1541 1541  
1542   - /* bomb out completely if something weird happened */
  1542 + /* bomb out completely if the connection bounced */
1543 1543 if ((portchange & USB_PORT_STAT_C_CONNECTION))
1544   - return -EINVAL;
  1544 + return -ENOTCONN;
1545 1545  
1546 1546 /* if we`ve finished resetting, then break out of the loop */
1547 1547 if (!(portstatus & USB_PORT_STAT_RESET) &&
... ... @@ -2974,7 +2974,7 @@
2974 2974 * Other endpoints will be handled by re-enumeration. */
2975 2975 ep0_reinit(udev);
2976 2976 ret = hub_port_init(parent_hub, udev, port1, i);
2977   - if (ret >= 0)
  2977 + if (ret >= 0 || ret == -ENOTCONN || ret == -ENODEV)
2978 2978 break;
2979 2979 }
2980 2980 clear_bit(port1, parent_hub->busy_bits);