aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/hub.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 4c259aca7a62..58d2cde0ebe2 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2896,10 +2896,12 @@ static int port_is_suspended(struct usb_hub *hub, unsigned portstatus)
2896 */ 2896 */
2897static int check_port_resume_type(struct usb_device *udev, 2897static int check_port_resume_type(struct usb_device *udev,
2898 struct usb_hub *hub, int port1, 2898 struct usb_hub *hub, int port1,
2899 int status, unsigned portchange, unsigned portstatus) 2899 int status, u16 portchange, u16 portstatus)
2900{ 2900{
2901 struct usb_port *port_dev = hub->ports[port1 - 1]; 2901 struct usb_port *port_dev = hub->ports[port1 - 1];
2902 int retries = 3;
2902 2903
2904 retry:
2903 /* Is a warm reset needed to recover the connection? */ 2905 /* Is a warm reset needed to recover the connection? */
2904 if (status == 0 && udev->reset_resume 2906 if (status == 0 && udev->reset_resume
2905 && hub_port_warm_reset_required(hub, port1, portstatus)) { 2907 && hub_port_warm_reset_required(hub, port1, portstatus)) {
@@ -2907,10 +2909,17 @@ static int check_port_resume_type(struct usb_device *udev,
2907 } 2909 }
2908 /* Is the device still present? */ 2910 /* Is the device still present? */
2909 else if (status || port_is_suspended(hub, portstatus) || 2911 else if (status || port_is_suspended(hub, portstatus) ||
2910 !port_is_power_on(hub, portstatus) || 2912 !port_is_power_on(hub, portstatus)) {
2911 !(portstatus & USB_PORT_STAT_CONNECTION)) {
2912 if (status >= 0) 2913 if (status >= 0)
2913 status = -ENODEV; 2914 status = -ENODEV;
2915 } else if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
2916 if (retries--) {
2917 usleep_range(200, 300);
2918 status = hub_port_status(hub, port1, &portstatus,
2919 &portchange);
2920 goto retry;
2921 }
2922 status = -ENODEV;
2914 } 2923 }
2915 2924
2916 /* Can't do a normal resume if the port isn't enabled, 2925 /* Can't do a normal resume if the port isn't enabled,