diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-03 15:49:52 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-03 15:49:52 -0400 |
commit | 45f0a85c8258741d11bda25c0a5669c06267204a (patch) | |
tree | a618cce0583426a5c7f53f56cf19139a6f9733ce /drivers/usb | |
parent | cd38ca854de15b26eb91009137cbe157d8a8e773 (diff) |
PM / Runtime: Rework the "runtime idle" helper routine
The "runtime idle" helper routine, rpm_idle(), currently ignores
return values from .runtime_idle() callbacks executed by it.
However, it turns out that many subsystems use
pm_generic_runtime_idle() which checks the return value of the
driver's callback and executes pm_runtime_suspend() for the device
unless that value is not 0. If that logic is moved to rpm_idle()
instead, pm_generic_runtime_idle() can be dropped and its users
will not need any .runtime_idle() callbacks any more.
Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle()
routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and
ata_port_runtime_idle(), respectively, as well as a few drivers'
ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has
been returned by the .runtime_idle() callback executed by it.
To reduce overall code bloat, make the changes described above.
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Kevin Hilman <khilman@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/driver.c | 3 | ||||
-rw-r--r-- | drivers/usb/core/port.c | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 6eab440e1542..7609ac4aed1c 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1765,7 +1765,8 @@ int usb_runtime_idle(struct device *dev) | |||
1765 | */ | 1765 | */ |
1766 | if (autosuspend_check(udev) == 0) | 1766 | if (autosuspend_check(udev) == 0) |
1767 | pm_runtime_autosuspend(dev); | 1767 | pm_runtime_autosuspend(dev); |
1768 | return 0; | 1768 | /* Tell the core not to suspend it, though. */ |
1769 | return -EBUSY; | ||
1769 | } | 1770 | } |
1770 | 1771 | ||
1771 | int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) | 1772 | int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) |
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index b8bad294eeb8..8c1b2c509467 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c | |||
@@ -141,7 +141,6 @@ static const struct dev_pm_ops usb_port_pm_ops = { | |||
141 | #ifdef CONFIG_PM_RUNTIME | 141 | #ifdef CONFIG_PM_RUNTIME |
142 | .runtime_suspend = usb_port_runtime_suspend, | 142 | .runtime_suspend = usb_port_runtime_suspend, |
143 | .runtime_resume = usb_port_runtime_resume, | 143 | .runtime_resume = usb_port_runtime_resume, |
144 | .runtime_idle = pm_generic_runtime_idle, | ||
145 | #endif | 144 | #endif |
146 | }; | 145 | }; |
147 | 146 | ||