summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_pm.c
diff options
context:
space:
mode:
authorSubhash Jadavani <subhashj@codeaurora.org>2014-11-18 00:54:25 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:00:58 -0700
commit2b80aee4b6b9109c5a68c765925488d37b6fb5e0 (patch)
tree4c22a88aeebde287c2785d67493ade0951695eb5 /drivers/scsi/scsi_pm.c
parentd8a844389a22602a9d43f147be1b2158ff69062b (diff)
scsi: pm: keep request queue and scsi device runtime status in sync
If scsi device is not runtime suspended while system resumes then scsi device's runtime PM status gets changed to RPM_ACTIVE (if its parent status is already set to RPM_ACTIVE) by the scsi system resume callback. But if the scsi device's runtime PM is managed by block layer then runtime status of scsi device's request queue might still remain in RPM_SUSPENDED hence all the new block requests submitted to the request queue will have to wait until the queue runtime status gets changed to RPM_ACTIVE which never happens as scsi device status is already marked RPM_ACTIVE. Fix this problem by changing the request queue runtime status to RPM_ACTIVE when scsi device runtime status changes to RPM_ACTIVE. Change-Id: I310cf8f1d7f13008b0ab9d87564fc0ac4d2e2314 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Diffstat (limited to 'drivers/scsi/scsi_pm.c')
-rw-r--r--drivers/scsi/scsi_pm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index 055b7cd933e6..64d058c96d83 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -84,8 +84,20 @@ static int scsi_dev_type_resume(struct device *dev,
if (err == 0 && (cb != do_scsi_runtime_resume)) {
pm_runtime_disable(dev);
- pm_runtime_set_active(dev);
+ err = pm_runtime_set_active(dev);
pm_runtime_enable(dev);
+
+ if (!err && scsi_is_sdev_device(dev)) {
+ struct scsi_device *sdev = to_scsi_device(dev);
+
+ /*
+ * If scsi device runtime PM is managed by block layer
+ * then we should update request queue's runtime status
+ * as well.
+ */
+ if (sdev->request_queue->dev)
+ blk_post_runtime_resume(sdev->request_queue, 0);
+ }
}
return err;