diff mbox

[1/1] SCSI:Fix rpm_status of request_queue in S3 resume of SCSI device

Message ID 1441793369.5845.87.camel@kxue-X58A-UD3R (mailing list archive)
State New, archived
Headers show

Commit Message

Ken Xue Sept. 9, 2015, 10:09 a.m. UTC
From d0b7698dda596831aa6a7efca1075a231f1ac5db Mon Sep 17 00:00:00 2001
From: Ken Xue <Ken.Xue@amd.com>
Date: Wed, 9 Sep 2015 17:36:59 +0800
Subject: [PATCH] SCSI:Fix rpm_status of request_queue in S3 resume
 of SCSI device

rpm_status of the request_queue is set to be RPM_SUSPENDED in
runtime suspend before S3. But there is a chance that rpm_status
is not recovered to be RPM_ACTIVE after S3 resume even the power
status of device already became active.

This leads to new request in request_queue cannot be handled and
device cannot goto runtime suspend anymore.

So, if device is suspended, keep this status until status of
request_queue and device all can be updated.

Signed-off-by: Ken Xue <Ken.Xue@amd.com>
---
 drivers/scsi/scsi_pm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index e4b7998..cfda027 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -110,7 +110,8 @@  scsi_bus_suspend_common(struct device *dev,
 
 static void async_sdev_resume(void *dev, async_cookie_t cookie)
 {
-	scsi_dev_type_resume(dev, do_scsi_resume);
+	if (!pm_runtime_suspended(dev))
+		scsi_dev_type_resume(dev, do_scsi_resume);
 }
 
 static void async_sdev_thaw(void *dev, async_cookie_t cookie)