aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-10 13:30:08 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-10 13:30:08 -0400
commit3dd392a407d15250a501fa109cc1f93fee95ef85 (patch)
treec1faca3fa8bd0f7c8790b3e0887229b4a5a90e8b /drivers/usb/core/hub.c
parentb27a43c1e90582facad44de67d02bc9e9f900289 (diff)
parentd403a6484f0341bf0624d17ece46f24f741b6a92 (diff)
Merge branch 'linus' into x86/pat2
Conflicts: arch/x86/mm/init_64.c
Diffstat (limited to 'drivers/usb/core/hub.c')
-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;