From patchwork Thu Jul 26 10:05:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v3,2/7] scsi: pm: use autosuspend if device supports it Date: Thu, 26 Jul 2012 00:05:24 -0000 From: Aaron Lu X-Patchwork-Id: 173391 Message-Id: <1343297129-28174-3-git-send-email-aaron.lu@amd.com> To: James Bottomley , Alan Stern Cc: Jeff Garzik , Lin Ming , Jeff Wu , , , , , Aaron Lu , Aaron Lu If the device is using autosuspend, when scsi_autopm_put_device is called for it, use autosuspend runtime pm calls instead of the sync call. Signed-off-by: Aaron Lu --- drivers/scsi/scsi_pm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c index dc0ad85..7c93723 100644 --- a/drivers/scsi/scsi_pm.c +++ b/drivers/scsi/scsi_pm.c @@ -197,7 +197,13 @@ EXPORT_SYMBOL_GPL(scsi_autopm_get_device); void scsi_autopm_put_device(struct scsi_device *sdev) { - pm_runtime_put_sync(&sdev->sdev_gendev); + if (sdev->sdev_gendev.power.use_autosuspend) { + pm_runtime_mark_last_busy(&sdev->sdev_gendev); + pm_runtime_put_autosuspend(&sdev->sdev_gendev); + } else { + pm_runtime_put_sync(&sdev->sdev_gendev); + } + } EXPORT_SYMBOL_GPL(scsi_autopm_put_device);