diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2006-10-30 17:07:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-01 17:23:30 -0500 |
commit | 692a186c9d5f12d43cef28d40c25247dc4f302f0 (patch) | |
tree | 8271b7930fbabfd6b6d5cc0a3b42e65ea56976d4 /drivers/usb/core | |
parent | af4f76066d0fcb215ae389b8839d7ae37ce0e28b (diff) |
USB: expand autosuspend/autoresume API
This patch (as814) adds usb_autopm_set_interface() to the autosuspend
API. It also provides convenient wrapper routines,
usb_autopm_enable() and usb_autopm_disable(), for drivers that want
to specify directly whether autosuspend should be allowed.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/driver.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index ca0e40ed2b72..204495fa6b3d 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1322,6 +1322,28 @@ int usb_autopm_get_interface(struct usb_interface *intf) | |||
1322 | } | 1322 | } |
1323 | EXPORT_SYMBOL_GPL(usb_autopm_get_interface); | 1323 | EXPORT_SYMBOL_GPL(usb_autopm_get_interface); |
1324 | 1324 | ||
1325 | /** | ||
1326 | * usb_autopm_set_interface - set a USB interface's autosuspend state | ||
1327 | * @intf: the usb_interface whose state should be set | ||
1328 | * | ||
1329 | * This routine sets the autosuspend state of @intf's device according | ||
1330 | * to @intf's usage counter, which the caller must have set previously. | ||
1331 | * If the counter is <= 0, the device is autosuspended (if it isn't | ||
1332 | * already suspended and if nothing else prevents the autosuspend). If | ||
1333 | * the counter is > 0, the device is autoresumed (if it isn't already | ||
1334 | * awake). | ||
1335 | */ | ||
1336 | int usb_autopm_set_interface(struct usb_interface *intf) | ||
1337 | { | ||
1338 | int status; | ||
1339 | |||
1340 | status = usb_autopm_do_interface(intf, 0); | ||
1341 | // dev_dbg(&intf->dev, "%s: status %d cnt %d\n", | ||
1342 | // __FUNCTION__, status, intf->pm_usage_cnt); | ||
1343 | return status; | ||
1344 | } | ||
1345 | EXPORT_SYMBOL_GPL(usb_autopm_set_interface); | ||
1346 | |||
1325 | #endif /* CONFIG_USB_SUSPEND */ | 1347 | #endif /* CONFIG_USB_SUSPEND */ |
1326 | 1348 | ||
1327 | static int usb_suspend(struct device *dev, pm_message_t message) | 1349 | static int usb_suspend(struct device *dev, pm_message_t message) |