aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r--drivers/usb/core/message.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 1580c81a0db7..28c6cf225780 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1366,9 +1366,6 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
1366 if (cp && configuration == 0) 1366 if (cp && configuration == 0)
1367 dev_warn(&dev->dev, "config 0 descriptor??\n"); 1367 dev_warn(&dev->dev, "config 0 descriptor??\n");
1368 1368
1369 if (dev->state == USB_STATE_SUSPENDED)
1370 return -EHOSTUNREACH;
1371
1372 /* Allocate memory for new interfaces before doing anything else, 1369 /* Allocate memory for new interfaces before doing anything else,
1373 * so that if we run out then nothing will have changed. */ 1370 * so that if we run out then nothing will have changed. */
1374 n = nintf = 0; 1371 n = nintf = 0;
@@ -1403,6 +1400,11 @@ free_interfaces:
1403 configuration, -i); 1400 configuration, -i);
1404 } 1401 }
1405 1402
1403 /* Wake up the device so we can send it the Set-Config request */
1404 ret = usb_autoresume_device(dev, 1);
1405 if (ret)
1406 goto free_interfaces;
1407
1406 /* if it's already configured, clear out old state first. 1408 /* if it's already configured, clear out old state first.
1407 * getting rid of old interfaces means unbinding their drivers. 1409 * getting rid of old interfaces means unbinding their drivers.
1408 */ 1410 */
@@ -1422,6 +1424,7 @@ free_interfaces:
1422 dev->actconfig = cp; 1424 dev->actconfig = cp;
1423 if (!cp) { 1425 if (!cp) {
1424 usb_set_device_state(dev, USB_STATE_ADDRESS); 1426 usb_set_device_state(dev, USB_STATE_ADDRESS);
1427 usb_autosuspend_device(dev, 1);
1425 goto free_interfaces; 1428 goto free_interfaces;
1426 } 1429 }
1427 usb_set_device_state(dev, USB_STATE_CONFIGURED); 1430 usb_set_device_state(dev, USB_STATE_CONFIGURED);
@@ -1490,6 +1493,7 @@ free_interfaces:
1490 usb_create_sysfs_intf_files (intf); 1493 usb_create_sysfs_intf_files (intf);
1491 } 1494 }
1492 1495
1496 usb_autosuspend_device(dev, 1);
1493 return 0; 1497 return 0;
1494} 1498}
1495 1499