diff mbox series

[v2,3/3] scsi: ufs: Narrow down fast pass in system suspend path

Message ID 1619408921-30426-4-git-send-email-cang@codeaurora.org
State New
Headers show
Series Three minor fixes w.r.t suspend/resume | expand

Commit Message

Can Guo April 26, 2021, 3:48 a.m. UTC
If spm_lvl is set to 0 or 1, when system suspend kicks start and hba is
runtime active, system suspend may just bail without doing anything (the
fast pass), leaving other contexts still running, e.g., clock gating and
clock scaling. When system resume kicks start, concurrency can happen btw
ufshcd_resume() and these contexts, leading to various stability issues.
Fix it by adding a check against hba's runtime status and allowing fast
pass only if hba is runtime suspended, otherwise let system suspend go
ahead call ufshcd_suspend(). This can guarantee that these contexts are
stopped by either runtime suspend or system suspend.

Fixes: 0b257734344aa ("scsi: ufs: optimize system suspend handling")
Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index a2f9c8e..c480f88 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -9050,6 +9050,7 @@  int ufshcd_system_suspend(struct ufs_hba *hba)
 	     hba->curr_dev_pwr_mode) &&
 	    (ufs_get_pm_lvl_to_link_pwr_state(hba->spm_lvl) ==
 	     hba->uic_link_state) &&
+	     pm_runtime_suspended(hba->dev) &&
 	     !hba->dev_info.b_rpm_dev_flush_capable)
 		goto out;