PM / Runtime: Rework the "runtime idle" helper routine
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 3 Jun 2013 19:49:52 +0000 (21:49 +0200)
committerlintao <lintao@rock-chips.com>
Fri, 7 Mar 2014 04:52:24 +0000 (12:52 +0800)
commite83e9aef512896a8160eaed1a1b093fd0b1d0008
tree59e9daf6736bb4e5f73ada652fa6ecc134e4fb45
parent65cdca44726f197895845bd19c4fe17d2ba95b25
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>
23 files changed:
Documentation/power/runtime_pm.txt
arch/arm/mach-omap2/omap_device.c
drivers/acpi/device_pm.c
drivers/amba/bus.c
drivers/ata/libata-core.c
drivers/base/platform.c
drivers/base/power/domain.c
drivers/base/power/generic_ops.c
drivers/base/power/runtime.c
drivers/dma/intel_mid_dma.c
drivers/gpio/gpio-langwell.c
drivers/i2c/i2c-core.c
drivers/mfd/ab8500-gpadc.c
drivers/mmc/core/bus.c
drivers/mmc/core/sdio_bus.c
drivers/pci/pci-driver.c
drivers/scsi/scsi_pm.c
drivers/sh/pm_runtime.c
drivers/spi/spi.c
drivers/tty/serial/mfd.c
drivers/usb/core/driver.c
drivers/usb/core/port.c
include/linux/pm_runtime.h