[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1619403878-28330-3-git-send-email-cang@codeaurora.org>
Date: Sun, 25 Apr 2021 19:24:36 -0700
From: Can Guo <cang@...eaurora.org>
To: asutoshd@...eaurora.org, ziqichen@...eaurora.org,
nguyenb@...eaurora.org, hongwus@...eaurora.org,
linux-scsi@...r.kernel.org, kernel-team@...roid.com,
cang@...eaurora.org
Cc: Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Stanley Chu <stanley.chu@...iatek.com>,
Bean Huo <beanhuo@...ron.com>,
Jaegeuk Kim <jaegeuk@...nel.org>,
Chaotian Jing <chaotian.jing@...iatek.com>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH v1 2/3] scsi: ufs: Cancel rpm_dev_flush_recheck_work during system suspend
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: 1d53864c3617f5235f891ca0fbe9347c4cd35d46 ("scsi: ufs: Fix possible power drain during system suspend")
Signed-off-by: Can Guo <cang@...eaurora.org>
---
drivers/scsi/ufs/ufshcd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 7ab6b12..090b654 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -9058,11 +9058,12 @@ 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) ==
- hba->uic_link_state) &&
- !hba->dev_info.b_rpm_dev_flush_capable)
+ hba->uic_link_state))
goto out;
if (pm_runtime_suspended(hba->dev)) {
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Powered by blists - more mailing lists