usb: Stop reset procedure when a dev is handed over to a companion hcd
authorHans de Goede <hdegoede@redhat.com>
Sun, 10 May 2015 12:10:16 +0000 (14:10 +0200)
committerSimon Glass <sjg@chromium.org>
Fri, 15 May 2015 00:49:31 +0000 (18:49 -0600)
Short circuit the retry loop in legacy_hub_port_reset() by returning an
error from usb_control_msg() when a device was handed over to a companion
by the ehci code. This avoids trying to reset low / fullspeed devices 5
times needlessly. Also do not print an error when a device has been handed
over.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
common/usb_hub.c
drivers/usb/host/ehci-hcd.c

index 7aac2201166300c2dab5a72a053c33ec408fab68..af39c76f7fa181843f4a22eaf01be2e385e11488 100644 (file)
@@ -271,7 +271,8 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
        /* Reset the port */
        ret = legacy_hub_port_reset(dev, port, &portstatus);
        if (ret < 0) {
-               printf("cannot reset port %i!?\n", port + 1);
+               if (ret != -ENXIO)
+                       printf("cannot reset port %i!?\n", port + 1);
                return ret;
        }
 
index ce760d0cd3056b21ec300e5324678a2aa811d8cd..e4c462f3438b204ba575117e053dd14c29ac22bb 100644 (file)
@@ -875,7 +875,7 @@ static int ehci_submit_root(struct usb_device *dev, unsigned long pipe,
                                      port - 1);
                                reg |= EHCI_PS_PO;
                                ehci_writel(status_reg, reg);
-                               break;
+                               return -ENXIO;
                        } else {
                                int ret;
 
@@ -905,6 +905,7 @@ static int ehci_submit_root(struct usb_device *dev, unsigned long pipe,
                                                reg &= ~EHCI_PS_CLEAR;
                                                reg |= EHCI_PS_PO;
                                                ehci_writel(status_reg, reg);
+                                               return -ENXIO;
                                        } else {
                                                ctrl->portreset |= 1 << port;
                                        }