[RFC 4/5] scsi, pm, use autosuspend for scsi runtime PM

From: Huang Ying
Date: Mon Feb 06 2012 - 02:33:06 EST


So that the timeout can be adjusted for each device, make it easy to
implement request and open/close based runtime PM.

Signed-off-by: Huang Ying <ying.huang@xxxxxxxxx>
---
drivers/scsi/scsi_pm.c | 2 +-
drivers/scsi/scsi_sysfs.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -157,7 +157,7 @@ static int scsi_runtime_idle(struct devi
/* Insert hooks here for targets, hosts, and transport classes */

if (scsi_is_sdev_device(dev))
- err = pm_schedule_suspend(dev, 100);
+ err = pm_runtime_autosuspend(dev);
else
err = pm_runtime_suspend(dev);
return err;
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -887,6 +887,8 @@ int scsi_sysfs_add_sdev(struct scsi_devi
pm_runtime_set_active(&sdev->sdev_gendev);
pm_runtime_forbid(&sdev->sdev_gendev);
pm_runtime_enable(&sdev->sdev_gendev);
+ pm_runtime_set_autosuspend_delay(&sdev->sdev_gendev, 100);
+ pm_runtime_use_autosuspend(&sdev->sdev_gendev);
scsi_autopm_put_target_sync(starget);

/* The following call will keep sdev active indefinitely, until
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/