| commit 7d0d20a25c6f477fb198b85510c78156d7d7c5af |
| Author: Matthew Garrett <mjg@redhat.com> |
| Date: Tue Jun 9 20:11:47 2009 +0100 |
| |
| usb: Allow drivers to enable USB autosuspend on a per-device basis |
| |
| USB autosuspend is currently only enabled by default for hubs. On other |
| hardware the decision is made by userspace. This is unnecessary in cases |
| where we know that the hardware supports autosuspend, so this patch adds |
| a function to allow drivers to enable it at probe time. |
| |
| Signed-off-by: Matthew Garrett <mjg@redhat.com> |
| |
| --- |
| drivers/usb/core/driver.c | 16 ++++++++++++++++ |
| include/linux/usb.h | 4 ++++ |
| 2 files changed, 20 insertions(+), 0 deletions(-) |
| |
| diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c |
| index 60a45f1..03e0228 100644 |
| --- a/drivers/usb/core/driver.c |
| +++ b/drivers/usb/core/driver.c |
| @@ -1648,6 +1648,21 @@ void usb_autopm_put_interface_async(struct usb_interface *intf) |
| EXPORT_SYMBOL_GPL(usb_autopm_put_interface_async); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| +void usb_device_autosuspend_enable(struct usb_device *udev) |
| +{ |
| + udev->autosuspend_disabled = 0; |
| + usb_external_suspend_device(udev, PMSG_USER_SUSPEND); |
| +} |
| +EXPORT_SYMBOL_GPL(usb_device_autosuspend_enable); |
| + |
| + |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #ifdef CONFIG_USB_SUSPEND |
| +extern void usb_device_autosuspend_enable(struct usb_device *udev); |
| extern int usb_autopm_get_interface(struct usb_interface *intf); |
| extern void usb_autopm_put_interface(struct usb_interface *intf); |
| extern int usb_autopm_get_interface_async(struct usb_interface *intf); |
| @@ -563,6 +564,9 @@ static inline void usb_mark_last_busy(struct usb_device *udev) |
| |
| #else |
| |
| +static inline void usb_device_autosuspend_enable(struct usb_device *udev) |
| +{ } |
| + |
| static inline int usb_autopm_get_interface(struct usb_interface *intf) |
| { return 0; } |
| static inline int usb_autopm_get_interface_async(struct usb_interface *intf) |
| -- |
| 1.6.5.2 |
| |
| |