aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/hub.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 830c851384bf..eb57fcc701d7 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1245,6 +1245,13 @@ static void release_address(struct usb_device *udev)
1245 } 1245 }
1246} 1246}
1247 1247
1248static void update_address(struct usb_device *udev, int devnum)
1249{
1250 /* The address for a WUSB device is managed by wusbcore. */
1251 if (!udev->wusb)
1252 udev->devnum = devnum;
1253}
1254
1248#ifdef CONFIG_USB_SUSPEND 1255#ifdef CONFIG_USB_SUSPEND
1249 1256
1250static void usb_stop_pm(struct usb_device *udev) 1257static void usb_stop_pm(struct usb_device *udev)
@@ -1733,7 +1740,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
1733 case 0: 1740 case 0:
1734 /* TRSTRCY = 10 ms; plus some extra */ 1741 /* TRSTRCY = 10 ms; plus some extra */
1735 msleep(10 + 40); 1742 msleep(10 + 40);
1736 udev->devnum = 0; /* Device now at address 0 */ 1743 update_address(udev, 0);
1737 /* FALL THROUGH */ 1744 /* FALL THROUGH */
1738 case -ENOTCONN: 1745 case -ENOTCONN:
1739 case -ENODEV: 1746 case -ENODEV:
@@ -2236,7 +2243,8 @@ static int hub_set_address(struct usb_device *udev, int devnum)
2236 USB_REQ_SET_ADDRESS, 0, devnum, 0, 2243 USB_REQ_SET_ADDRESS, 0, devnum, 0,
2237 NULL, 0, USB_CTRL_SET_TIMEOUT); 2244 NULL, 0, USB_CTRL_SET_TIMEOUT);
2238 if (retval == 0) { 2245 if (retval == 0) {
2239 udev->devnum = devnum; /* Device now using proper address */ 2246 /* Device now using proper address. */
2247 update_address(udev, devnum);
2240 usb_set_device_state(udev, USB_STATE_ADDRESS); 2248 usb_set_device_state(udev, USB_STATE_ADDRESS);
2241 usb_ep0_reinit(udev); 2249 usb_ep0_reinit(udev);
2242 } 2250 }
@@ -2491,7 +2499,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
2491fail: 2499fail:
2492 if (retval) { 2500 if (retval) {
2493 hub_port_disable(hub, port1, 0); 2501 hub_port_disable(hub, port1, 0);
2494 udev->devnum = devnum; /* for disconnect processing */ 2502 update_address(udev, devnum); /* for disconnect processing */
2495 } 2503 }
2496 mutex_unlock(&usb_address0_mutex); 2504 mutex_unlock(&usb_address0_mutex);
2497 return retval; 2505 return retval;