diff options
| author | Alan Stern <stern@rowland.harvard.edu> | 2009-12-07 13:01:37 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 14:55:25 -0500 |
| commit | 8e4ceb38eb5bbaef22fc00abe9bc11e26bea2ab5 (patch) | |
| tree | 7cb5fee6c50add1094aed430d46afeb2c7689b51 /include/linux | |
| parent | 9af23624ae2c7978313b46e58fdc4ca5d8b799f5 (diff) | |
USB: prepare for changover to Runtime PM framework
This patch (as1303) revises the USB Power Management infrastructure to
make it compatible with the new driver-model Runtime PM framework:
Drivers are no longer allowed to access intf->pm_usage_cnt
directly; the PM framework manages its own usage counters.
usb_autopm_set_interface() is eliminated, because it directly
sets intf->pm_usage_cnt.
usb_autopm_enable() and usb_autopm_disable() are eliminated,
because they call usb_autopm_set_interface().
usb_autopm_get_interface_no_resume() and
usb_autopm_put_interface_no_suspend() are added. They
correspond to pm_runtime_get_noresume() and
pm_runtime_put_noidle() in the PM framework.
The power/level attribute no longer accepts "suspend", only
"on" and "auto". The PM framework doesn't allow devices to be
forced into a suspended mode.
The hub driver contains the only code that violates the new
guidelines. It is updated to use the new interface routines instead.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/usb.h | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 4b6f6db544e..6af3581e111 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -432,7 +432,6 @@ struct usb_tt; | |||
| 432 | * @do_remote_wakeup: remote wakeup should be enabled | 432 | * @do_remote_wakeup: remote wakeup should be enabled |
| 433 | * @reset_resume: needs reset instead of resume | 433 | * @reset_resume: needs reset instead of resume |
| 434 | * @autosuspend_disabled: autosuspend disabled by the user | 434 | * @autosuspend_disabled: autosuspend disabled by the user |
| 435 | * @autoresume_disabled: autoresume disabled by the user | ||
| 436 | * @skip_sys_resume: skip the next system resume | 435 | * @skip_sys_resume: skip the next system resume |
| 437 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB | 436 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB |
| 438 | * specific data for the device. | 437 | * specific data for the device. |
| @@ -516,7 +515,6 @@ struct usb_device { | |||
| 516 | unsigned do_remote_wakeup:1; | 515 | unsigned do_remote_wakeup:1; |
| 517 | unsigned reset_resume:1; | 516 | unsigned reset_resume:1; |
| 518 | unsigned autosuspend_disabled:1; | 517 | unsigned autosuspend_disabled:1; |
| 519 | unsigned autoresume_disabled:1; | ||
| 520 | unsigned skip_sys_resume:1; | 518 | unsigned skip_sys_resume:1; |
| 521 | #endif | 519 | #endif |
| 522 | struct wusb_dev *wusb_dev; | 520 | struct wusb_dev *wusb_dev; |
| @@ -542,22 +540,20 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); | |||
| 542 | 540 | ||
| 543 | /* USB autosuspend and autoresume */ | 541 | /* USB autosuspend and autoresume */ |
| 544 | #ifdef CONFIG_USB_SUSPEND | 542 | #ifdef CONFIG_USB_SUSPEND |
| 545 | extern int usb_autopm_set_interface(struct usb_interface *intf); | ||
| 546 | extern int usb_autopm_get_interface(struct usb_interface *intf); | 543 | extern int usb_autopm_get_interface(struct usb_interface *intf); |
| 547 | extern void usb_autopm_put_interface(struct usb_interface *intf); | 544 | extern void usb_autopm_put_interface(struct usb_interface *intf); |
| 548 | extern int usb_autopm_get_interface_async(struct usb_interface *intf); | 545 | extern int usb_autopm_get_interface_async(struct usb_interface *intf); |
| 549 | extern void usb_autopm_put_interface_async(struct usb_interface *intf); | 546 | extern void usb_autopm_put_interface_async(struct usb_interface *intf); |
| 550 | 547 | ||
| 551 | static inline void usb_autopm_enable(struct usb_interface *intf) | 548 | static inline void usb_autopm_get_interface_no_resume( |
| 549 | struct usb_interface *intf) | ||
| 552 | { | 550 | { |
| 553 | atomic_set(&intf->pm_usage_cnt, 0); | 551 | atomic_inc(&intf->pm_usage_cnt); |
| 554 | usb_autopm_set_interface(intf); | ||
| 555 | } | 552 | } |
| 556 | 553 | static inline void usb_autopm_put_interface_no_suspend( | |
| 557 | static inline void usb_autopm_disable(struct usb_interface *intf) | 554 | struct usb_interface *intf) |
| 558 | { | 555 | { |
| 559 | atomic_set(&intf->pm_usage_cnt, 1); | 556 | atomic_dec(&intf->pm_usage_cnt); |
| 560 | usb_autopm_set_interface(intf); | ||
| 561 | } | 557 | } |
| 562 | 558 | ||
| 563 | static inline void usb_mark_last_busy(struct usb_device *udev) | 559 | static inline void usb_mark_last_busy(struct usb_device *udev) |
| @@ -567,12 +563,8 @@ static inline void usb_mark_last_busy(struct usb_device *udev) | |||
| 567 | 563 | ||
| 568 | #else | 564 | #else |
| 569 | 565 | ||
| 570 | static inline int usb_autopm_set_interface(struct usb_interface *intf) | ||
| 571 | { return 0; } | ||
| 572 | |||
| 573 | static inline int usb_autopm_get_interface(struct usb_interface *intf) | 566 | static inline int usb_autopm_get_interface(struct usb_interface *intf) |
| 574 | { return 0; } | 567 | { return 0; } |
| 575 | |||
| 576 | static inline int usb_autopm_get_interface_async(struct usb_interface *intf) | 568 | static inline int usb_autopm_get_interface_async(struct usb_interface *intf) |
| 577 | { return 0; } | 569 | { return 0; } |
| 578 | 570 | ||
| @@ -580,9 +572,11 @@ static inline void usb_autopm_put_interface(struct usb_interface *intf) | |||
| 580 | { } | 572 | { } |
| 581 | static inline void usb_autopm_put_interface_async(struct usb_interface *intf) | 573 | static inline void usb_autopm_put_interface_async(struct usb_interface *intf) |
| 582 | { } | 574 | { } |
| 583 | static inline void usb_autopm_enable(struct usb_interface *intf) | 575 | static inline void usb_autopm_get_interface_no_resume( |
| 576 | struct usb_interface *intf) | ||
| 584 | { } | 577 | { } |
| 585 | static inline void usb_autopm_disable(struct usb_interface *intf) | 578 | static inline void usb_autopm_put_interface_no_suspend( |
| 579 | struct usb_interface *intf) | ||
| 586 | { } | 580 | { } |
| 587 | static inline void usb_mark_last_busy(struct usb_device *udev) | 581 | static inline void usb_mark_last_busy(struct usb_device *udev) |
| 588 | { } | 582 | { } |
