summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Bozek <dominikx.bozek@intel.com>2018-04-13 10:42:31 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-03 07:55:25 +0200
commit399e549fe55d4591883eb7b3dc254832fb09773e (patch)
tree2ff19a490aaabfbfda499b2ca5a192e72bdf37ec
parenteac904dd39f4c69b7c9119444ab34c21d88cc1e5 (diff)
usb: hub: Don't wait for connect state at resume for powered-off ports
[ 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>
-rw-r--r--drivers/usb/core/hub.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index bdb19db542a4..7aee55244b4a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3363,6 +3363,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);