]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
usb: hub: Don't wait for connect state at resume for powered-off ports
authorDominik Bozek <dominikx.bozek@intel.com>
Fri, 13 Apr 2018 17:42:31 +0000 (10:42 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 1 Mar 2019 13:20:51 +0000 (14:20 +0100)
BugLink: http://bugs.launchpad.net/bugs/1815234
[ Upstream commit 5d111f5190848d6fb1c414dc57797efea3526a2f ]

wait_for_connected() wait till a port change status to
USB_PORT_STAT_CONNECTION, but this is not possible if
the port is unpowered. The loop will only exit at timeout.

Such case take place if an over-current incident happen
while system is in S3. Then during resume wait_for_connected()
will wait 2s, which may be noticeable by the user.

Signed-off-by: Dominik Bozek <dominikx.bozek@intel.com>
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/usb/core/hub.c

index 02f69319b190d277ff95ce8fa88430058f215bd4..19c1c57ffd5c0331ca03bfe767f575ef8f330108 100644 (file)
@@ -3367,6 +3367,10 @@ static int wait_for_connected(struct usb_device *udev,
        while (delay_ms < 2000) {
                if (status || *portstatus & USB_PORT_STAT_CONNECTION)
                        break;
+               if (!port_is_power_on(hub, *portstatus)) {
+                       status = -ENODEV;
+                       break;
+               }
                msleep(20);
                delay_ms += 20;
                status = hub_port_status(hub, *port1, portstatus, portchange);