Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41265
b: refs/heads/master
c: 692a186
h: refs/heads/master
i:
  41263: c4ff406
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Dec 1, 2006
1 parent 57f5bef commit 1e2cea4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: af4f76066d0fcb215ae389b8839d7ae37ce0e28b
refs/heads/master: 692a186c9d5f12d43cef28d40c25247dc4f302f0
22 changes: 22 additions & 0 deletions trunk/drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,28 @@ int usb_autopm_get_interface(struct usb_interface *intf)
}
EXPORT_SYMBOL_GPL(usb_autopm_get_interface);

/**
* usb_autopm_set_interface - set a USB interface's autosuspend state
* @intf: the usb_interface whose state should be set
*
* This routine sets the autosuspend state of @intf's device according
* to @intf's usage counter, which the caller must have set previously.
* If the counter is <= 0, the device is autosuspended (if it isn't
* already suspended and if nothing else prevents the autosuspend). If
* the counter is > 0, the device is autoresumed (if it isn't already
* awake).
*/
int usb_autopm_set_interface(struct usb_interface *intf)
{
int status;

status = usb_autopm_do_interface(intf, 0);
// dev_dbg(&intf->dev, "%s: status %d cnt %d\n",
// __FUNCTION__, status, intf->pm_usage_cnt);
return status;
}
EXPORT_SYMBOL_GPL(usb_autopm_set_interface);

#endif /* CONFIG_USB_SUSPEND */

static int usb_suspend(struct device *dev, pm_message_t message)
Expand Down
29 changes: 26 additions & 3 deletions trunk/include/linux/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,37 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);

/* USB autosuspend and autoresume */
#ifdef CONFIG_USB_SUSPEND
extern int usb_autopm_set_interface(struct usb_interface *intf);
extern int usb_autopm_get_interface(struct usb_interface *intf);
extern void usb_autopm_put_interface(struct usb_interface *intf);

static inline void usb_autopm_enable(struct usb_interface *intf)
{
intf->pm_usage_cnt = 0;
usb_autopm_set_interface(intf);
}

static inline void usb_autopm_disable(struct usb_interface *intf)
{
intf->pm_usage_cnt = 1;
usb_autopm_set_interface(intf);
}

#else
#define usb_autopm_get_interface(intf) 0
#define usb_autopm_put_interface(intf) do {} while (0)
#endif

static inline int usb_autopm_set_interface(struct usb_interface *intf)
{ return 0; }

static inline int usb_autopm_get_interface(struct usb_interface *intf)
{ return 0; }

static inline void usb_autopm_put_interface(struct usb_interface *intf)
{ }
static inline void usb_autopm_enable(struct usb_interface *intf)
{ }
static inline void usb_autopm_disable(struct usb_interface *intf)
{ }
#endif

/*-------------------------------------------------------------------------*/

Expand Down

0 comments on commit 1e2cea4

Please sign in to comment.