aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/message.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-08-30 15:47:18 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-27 14:58:57 -0400
commit01d883d44a1ca8dc77486635d428cba63e7fdadf (patch)
tree447a4293b2ec4dfa1b3d03a46a3a33498809f0e8 /drivers/usb/core/message.c
parent645daaab0b6adc35c1838df2a82f9d729fdb1767 (diff)
usbcore: non-hub-specific uses of autosuspend
This patch (as741) makes the non-hub parts of usbcore actually use the autosuspend facilities added by an earlier patch. Devices opened through usbfs are autoresumed and then autosuspended upon close. Likewise for usb-skeleton. Devices are autoresumed for usb_set_configuration. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 1580c81a0db..28c6cf22578 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