From: Dominik Bozek Date: Fri, 13 Apr 2018 17:42:31 +0000 (-0700) Subject: usb: hub: Don't wait for connect state at resume for powered-off ports X-Git-Tag: v4.18-rc1~136^2~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d111f5190848d6fb1c414dc57797efea3526a2f;p=thirdparty%2Flinux.git usb: hub: Don't wait for connect state at resume for powered-off ports 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 Signed-off-by: Kuppuswamy Sathyanarayanan Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index f6ea16e9f6bb9..9e79bcf03cde1 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3371,6 +3371,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);