aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-03-18 14:55:36 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2011-03-18 14:55:36 -0400
commite1620d591a75a10b15cf61dbf8243a0b7e6731a2 (patch)
tree01facc1611d08d80fc1f0a3d430e83779e9fbdc5 /drivers/usb/core
parent99759619b27662d1290901228d77a293e6e83200 (diff)
USB: Move runtime PM callbacks to usb_device_pm_ops
USB defines usb_device_type pointing to usb_device_pm_ops that provides system-wide PM callbacks only and usb_bus_type pointing to usb_bus_pm_ops that provides runtime PM callbacks only. However, the USB runtime PM callbacks may be defined in usb_device_pm_ops which makes it possible to drop usb_bus_pm_ops and will allow us to consolidate the handling of subsystems by the PM core code. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/driver.c15
-rw-r--r--drivers/usb/core/usb.c5
-rw-r--r--drivers/usb/core/usb.h3
3 files changed, 11 insertions, 12 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 38072e4e74bd..e35a17687c05 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1646,7 +1646,7 @@ static int autosuspend_check(struct usb_device *udev)
1646 return 0; 1646 return 0;
1647} 1647}
1648 1648
1649static int usb_runtime_suspend(struct device *dev) 1649int usb_runtime_suspend(struct device *dev)
1650{ 1650{
1651 struct usb_device *udev = to_usb_device(dev); 1651 struct usb_device *udev = to_usb_device(dev);
1652 int status; 1652 int status;
@@ -1667,7 +1667,7 @@ static int usb_runtime_suspend(struct device *dev)
1667 return status; 1667 return status;
1668} 1668}
1669 1669
1670static int usb_runtime_resume(struct device *dev) 1670int usb_runtime_resume(struct device *dev)
1671{ 1671{
1672 struct usb_device *udev = to_usb_device(dev); 1672 struct usb_device *udev = to_usb_device(dev);
1673 int status; 1673 int status;
@@ -1679,7 +1679,7 @@ static int usb_runtime_resume(struct device *dev)
1679 return status; 1679 return status;
1680} 1680}
1681 1681
1682static int usb_runtime_idle(struct device *dev) 1682int usb_runtime_idle(struct device *dev)
1683{ 1683{
1684 struct usb_device *udev = to_usb_device(dev); 1684 struct usb_device *udev = to_usb_device(dev);
1685 1685
@@ -1691,19 +1691,10 @@ static int usb_runtime_idle(struct device *dev)
1691 return 0; 1691 return 0;
1692} 1692}
1693 1693
1694static const struct dev_pm_ops usb_bus_pm_ops = {
1695 .runtime_suspend = usb_runtime_suspend,
1696 .runtime_resume = usb_runtime_resume,
1697 .runtime_idle = usb_runtime_idle,
1698};
1699
1700#endif /* CONFIG_USB_SUSPEND */ 1694#endif /* CONFIG_USB_SUSPEND */
1701 1695
1702struct bus_type usb_bus_type = { 1696struct bus_type usb_bus_type = {
1703 .name = "usb", 1697 .name = "usb",
1704 .match = usb_device_match, 1698 .match = usb_device_match,
1705 .uevent = usb_uevent, 1699 .uevent = usb_uevent,
1706#ifdef CONFIG_USB_SUSPEND
1707 .pm = &usb_bus_pm_ops,
1708#endif
1709}; 1700};
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 079cb57bab4f..d9d4b169404f 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -315,6 +315,11 @@ static const struct dev_pm_ops usb_device_pm_ops = {
315 .thaw = usb_dev_thaw, 315 .thaw = usb_dev_thaw,
316 .poweroff = usb_dev_poweroff, 316 .poweroff = usb_dev_poweroff,
317 .restore = usb_dev_restore, 317 .restore = usb_dev_restore,
318#ifdef CONFIG_USB_SUSPEND
319 .runtime_suspend = usb_runtime_suspend,
320 .runtime_resume = usb_runtime_resume,
321 .runtime_idle = usb_runtime_idle,
322#endif
318}; 323};
319 324
320#endif /* CONFIG_PM */ 325#endif /* CONFIG_PM */
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index a9cf484ecae4..d450b742137e 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -77,6 +77,9 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg)
77extern void usb_autosuspend_device(struct usb_device *udev); 77extern void usb_autosuspend_device(struct usb_device *udev);
78extern int usb_autoresume_device(struct usb_device *udev); 78extern int usb_autoresume_device(struct usb_device *udev);
79extern int usb_remote_wakeup(struct usb_device *dev); 79extern int usb_remote_wakeup(struct usb_device *dev);
80extern int usb_runtime_suspend(struct device *dev);
81extern int usb_runtime_resume(struct device *dev);
82extern int usb_runtime_idle(struct device *dev);
80 83
81#else 84#else
82 85