aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-10-30 17:07:51 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 17:23:30 -0500
commit692a186c9d5f12d43cef28d40c25247dc4f302f0 (patch)
tree8271b7930fbabfd6b6d5cc0a3b42e65ea56976d4 /include/linux/usb.h
parentaf4f76066d0fcb215ae389b8839d7ae37ce0e28b (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 'include/linux/usb.h')
-rw-r--r--include/linux/usb.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index e732e024a141..864c6c21c21e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -415,14 +415,37 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
415 415
416/* USB autosuspend and autoresume */ 416/* USB autosuspend and autoresume */
417#ifdef CONFIG_USB_SUSPEND 417#ifdef CONFIG_USB_SUSPEND
418extern int usb_autopm_set_interface(struct usb_interface *intf);
418extern int usb_autopm_get_interface(struct usb_interface *intf); 419extern int usb_autopm_get_interface(struct usb_interface *intf);
419extern void usb_autopm_put_interface(struct usb_interface *intf); 420extern void usb_autopm_put_interface(struct usb_interface *intf);
420 421
422static inline void usb_autopm_enable(struct usb_interface *intf)
423{
424 intf->pm_usage_cnt = 0;
425 usb_autopm_set_interface(intf);
426}
427
428static inline void usb_autopm_disable(struct usb_interface *intf)
429{
430 intf->pm_usage_cnt = 1;
431 usb_autopm_set_interface(intf);
432}
433
421#else 434#else
422#define usb_autopm_get_interface(intf) 0
423#define usb_autopm_put_interface(intf) do {} while (0)
424#endif
425 435
436static inline int usb_autopm_set_interface(struct usb_interface *intf)
437{ return 0; }
438
439static inline int usb_autopm_get_interface(struct usb_interface *intf)
440{ return 0; }
441
442static inline void usb_autopm_put_interface(struct usb_interface *intf)
443{ }
444static inline void usb_autopm_enable(struct usb_interface *intf)
445{ }
446static inline void usb_autopm_disable(struct usb_interface *intf)
447{ }
448#endif
426 449
427/*-------------------------------------------------------------------------*/ 450/*-------------------------------------------------------------------------*/
428 451