diff mbox series

[v2,2/3] scsi: ufs: Cancel rpm_dev_flush_recheck_work during system suspend

Message ID 1619408921-30426-3-git-send-email-cang@codeaurora.org (mailing list archive)
State Accepted
Headers show
Series Three minor fixes w.r.t suspend/resume | expand

Commit Message

Can Guo April 26, 2021, 3:48 a.m. UTC
During ufs system suspend, leaving rpm_dev_flush_recheck_work running or
pending is risky, because concurrency may happen btw system suspend/resume
and runtime resume routine. Fix it by cancelling rpm_dev_flush_recheck_work
synchronously during system suspend.

Fixes: 51dd905bd2f61 ("scsi: ufs: Fix WriteBooster flush during runtime suspend")
Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufshcd.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 28501bb..a2f9c8e 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -9044,6 +9044,8 @@  int ufshcd_system_suspend(struct ufs_hba *hba)
 	if (!hba->is_powered)
 		return 0;
 
+	cancel_delayed_work_sync(&hba->rpm_dev_flush_recheck_work);
+
 	if ((ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) ==
 	     hba->curr_dev_pwr_mode) &&
 	    (ufs_get_pm_lvl_to_link_pwr_state(hba->spm_lvl) ==