aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-09-22 14:43:08 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-09-23 16:58:10 -0400
commit5257d97a219e17abf8188f136e1189da3b3af33c (patch)
tree0fd223387fe974f395ed09b1d7a0f5c356dddd65 /drivers/usb
parentaf747c460b663a4b7795dc3f6897b5506fde6888 (diff)
USB: revert recovery from transient errors
This patch (as1135) essentially reverts the major parts of two earlier patches to usbcore, because they ended up causing a regression. Trying to recover from transient communication errors can lead to other problems, because operations that failed during the error period are not always retried. The simplest example is the initial Set-Config request sent after device enumeration; if it gets lost then it will not be retried and the device will remain unconfigured. This patch restores the old behavior in which any port disconnect or port disable causes the entire device structure to be removed, fixing a reported regression. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Tested-by: Frans Pop <elendil@planet.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/hub.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 6a5cb018383d..d99963873e37 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2683,35 +2683,17 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2683 USB_PORT_STAT_C_ENABLE); 2683 USB_PORT_STAT_C_ENABLE);
2684#endif 2684#endif
2685 2685
2686 /* Try to use the debounce delay for protection against
2687 * port-enable changes caused, for example, by EMI.
2688 */
2689 if (portchange & (USB_PORT_STAT_C_CONNECTION |
2690 USB_PORT_STAT_C_ENABLE)) {
2691 status = hub_port_debounce(hub, port1);
2692 if (status < 0) {
2693 if (printk_ratelimit())
2694 dev_err (hub_dev, "connect-debounce failed, "
2695 "port %d disabled\n", port1);
2696 portstatus &= ~USB_PORT_STAT_CONNECTION;
2697 } else {
2698 portstatus = status;
2699 }
2700 }
2701
2702 /* Try to resuscitate an existing device */ 2686 /* Try to resuscitate an existing device */
2703 udev = hdev->children[port1-1]; 2687 udev = hdev->children[port1-1];
2704 if ((portstatus & USB_PORT_STAT_CONNECTION) && udev && 2688 if ((portstatus & USB_PORT_STAT_CONNECTION) && udev &&
2705 udev->state != USB_STATE_NOTATTACHED) { 2689 udev->state != USB_STATE_NOTATTACHED) {
2706
2707 usb_lock_device(udev); 2690 usb_lock_device(udev);
2708 if (portstatus & USB_PORT_STAT_ENABLE) { 2691 if (portstatus & USB_PORT_STAT_ENABLE) {
2709 status = 0; /* Nothing to do */ 2692 status = 0; /* Nothing to do */
2710 } else if (!udev->persist_enabled) {
2711 status = -ENODEV; /* Mustn't resuscitate */
2712 2693
2713#ifdef CONFIG_USB_SUSPEND 2694#ifdef CONFIG_USB_SUSPEND
2714 } else if (udev->state == USB_STATE_SUSPENDED) { 2695 } else if (udev->state == USB_STATE_SUSPENDED &&
2696 udev->persist_enabled) {
2715 /* For a suspended device, treat this as a 2697 /* For a suspended device, treat this as a
2716 * remote wakeup event. 2698 * remote wakeup event.
2717 */ 2699 */
@@ -2726,7 +2708,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2726#endif 2708#endif
2727 2709
2728 } else { 2710 } else {
2729 status = usb_reset_device(udev); 2711 status = -ENODEV; /* Don't resuscitate */
2730 } 2712 }
2731 usb_unlock_device(udev); 2713 usb_unlock_device(udev);
2732 2714
@@ -2741,6 +2723,19 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2741 usb_disconnect(&hdev->children[port1-1]); 2723 usb_disconnect(&hdev->children[port1-1]);
2742 clear_bit(port1, hub->change_bits); 2724 clear_bit(port1, hub->change_bits);
2743 2725
2726 if (portchange & (USB_PORT_STAT_C_CONNECTION |
2727 USB_PORT_STAT_C_ENABLE)) {
2728 status = hub_port_debounce(hub, port1);
2729 if (status < 0) {
2730 if (printk_ratelimit())
2731 dev_err(hub_dev, "connect-debounce failed, "
2732 "port %d disabled\n", port1);
2733 portstatus &= ~USB_PORT_STAT_CONNECTION;
2734 } else {
2735 portstatus = status;
2736 }
2737 }
2738
2744 /* Return now if debouncing failed or nothing is connected */ 2739 /* Return now if debouncing failed or nothing is connected */
2745 if (!(portstatus & USB_PORT_STAT_CONNECTION)) { 2740 if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
2746 2741
@@ -2748,7 +2743,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2748 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2 2743 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
2749 && !(portstatus & (1 << USB_PORT_FEAT_POWER))) 2744 && !(portstatus & (1 << USB_PORT_FEAT_POWER)))
2750 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); 2745 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
2751 2746
2752 if (portstatus & USB_PORT_STAT_ENABLE) 2747 if (portstatus & USB_PORT_STAT_ENABLE)
2753 goto done; 2748 goto done;
2754 return; 2749 return;