aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_pm.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-03 15:49:52 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-03 15:49:52 -0400
commit45f0a85c8258741d11bda25c0a5669c06267204a (patch)
treea618cce0583426a5c7f53f56cf19139a6f9733ce /drivers/scsi/scsi_pm.c
parentcd38ca854de15b26eb91009137cbe157d8a8e773 (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/scsi/scsi_pm.c')
-rw-r--r--drivers/scsi/scsi_pm.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index 42539ee2cb11..4c5aabe21755 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -229,8 +229,6 @@ static int scsi_runtime_resume(struct device *dev)
229 229
230static int scsi_runtime_idle(struct device *dev) 230static int scsi_runtime_idle(struct device *dev)
231{ 231{
232 int err;
233
234 dev_dbg(dev, "scsi_runtime_idle\n"); 232 dev_dbg(dev, "scsi_runtime_idle\n");
235 233
236 /* Insert hooks here for targets, hosts, and transport classes */ 234 /* Insert hooks here for targets, hosts, and transport classes */
@@ -240,14 +238,11 @@ static int scsi_runtime_idle(struct device *dev)
240 238
241 if (sdev->request_queue->dev) { 239 if (sdev->request_queue->dev) {
242 pm_runtime_mark_last_busy(dev); 240 pm_runtime_mark_last_busy(dev);
243 err = pm_runtime_autosuspend(dev); 241 pm_runtime_autosuspend(dev);
244 } else { 242 return -EBUSY;
245 err = pm_runtime_suspend(dev);
246 } 243 }
247 } else {
248 err = pm_runtime_suspend(dev);
249 } 244 }
250 return err; 245 return 0;
251} 246}
252 247
253int scsi_autopm_get_device(struct scsi_device *sdev) 248int scsi_autopm_get_device(struct scsi_device *sdev)