aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-01-08 12:56:54 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:54:10 -0500
commit088f7fec8a0e683db72fd8826c5d3ab914e197b1 (patch)
tree971ef100d0db9727e4403865b67c72de62e8247a /drivers/usb/core/hub.c
parent0c4db6df915bc470f0cd32fe48287fa6eb6adfb4 (diff)
USB: implement usb_enable_autosuspend
This patch (as1326) adds usb_enable_autosuspend() and usb_disable_autosuspend() routines for use by drivers. If a driver knows that its device can handle suspends and resumes correctly, it can enable autosuspend all by itself. This is equivalent to the user writing "auto" to the device's power/level attribute. The implementation differs slightly from what it used to be. Now autosuspend is disabled simply by doing usb_autoresume_device() (to increment the usage counter) and enabled by doing usb_autosuspend_device() (to decrement the usage counter). The set_level() attribute method is updated to use the new routines, and the USB Power-Management documentation is updated. The patch adds a usb_enable_autosuspend() call to the hub driver's probe routine, allowing the special-case code for hubs in quirks.c to be removed. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index bfa6123bbdb..746f26f222a 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1224,6 +1224,9 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
1224 desc = intf->cur_altsetting; 1224 desc = intf->cur_altsetting;
1225 hdev = interface_to_usbdev(intf); 1225 hdev = interface_to_usbdev(intf);
1226 1226
1227 /* Hubs have proper suspend/resume support */
1228 usb_enable_autosuspend(hdev);
1229
1227 if (hdev->level == MAX_TOPO_LEVEL) { 1230 if (hdev->level == MAX_TOPO_LEVEL) {
1228 dev_err(&intf->dev, 1231 dev_err(&intf->dev,
1229 "Unsupported bus topology: hub nested too deep\n"); 1232 "Unsupported bus topology: hub nested too deep\n");