diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-01-08 12:56:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:54:10 -0500 |
commit | 088f7fec8a0e683db72fd8826c5d3ab914e197b1 (patch) | |
tree | 971ef100d0db9727e4403865b67c72de62e8247a /drivers/usb/core/quirks.c | |
parent | 0c4db6df915bc470f0cd32fe48287fa6eb6adfb4 (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/quirks.c')
-rw-r--r-- | drivers/usb/core/quirks.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 0b689224394b..4314f259524b 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -103,11 +103,10 @@ void usb_detect_quirks(struct usb_device *udev) | |||
103 | dev_dbg(&udev->dev, "USB quirks for this device: %x\n", | 103 | dev_dbg(&udev->dev, "USB quirks for this device: %x\n", |
104 | udev->quirks); | 104 | udev->quirks); |
105 | 105 | ||
106 | /* By default, disable autosuspend for all non-hubs */ | 106 | /* By default, disable autosuspend for all devices. The hub driver |
107 | #ifdef CONFIG_USB_SUSPEND | 107 | * will enable it for hubs. |
108 | if (udev->descriptor.bDeviceClass != USB_CLASS_HUB) | 108 | */ |
109 | udev->autosuspend_disabled = 1; | 109 | usb_disable_autosuspend(udev); |
110 | #endif | ||
111 | 110 | ||
112 | /* For the present, all devices default to USB-PERSIST enabled */ | 111 | /* For the present, all devices default to USB-PERSIST enabled */ |
113 | #if 0 /* was: #ifdef CONFIG_PM */ | 112 | #if 0 /* was: #ifdef CONFIG_PM */ |