From 63e416b3cabb34a0a117ad2e1a234411356b2f0e Mon Sep 17 00:00:00 2001 From: Kiwoong Kim Date: Sat, 19 Dec 2020 15:36:41 +0900 Subject: [PATCH] FROMGIT: ufs: relocate flush of exceptional event I found one case as follows and the current flush location doesn't guarantee disabling BKOPS in the case of requsting device power off. 1) The exceptional event handler is queued. 2) ufs suspend starts with a request of device power off 3) BKOPS is disabled in ufs suspend 4) The queued work for the handler is done and BKOPS is enabled again. Bug: 177395905 Change-Id: Ib69b8ebfb97469ff37ef8a70bdbc1ac2e79adcb0 (cherry picked from commit 6948a96a0d69b7e8203758f44849ce4ab06ff788 https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.11/scsi-fixes) Signed-off-by: Kiwoong Kim Reviewed-by: Can Guo Reviewed-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index dc426f3a0ae6..971dd0717389 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8676,6 +8676,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ufshcd_wb_need_flush(hba)); } + flush_work(&hba->eeh_work); + if (req_dev_pwr_mode != hba->curr_dev_pwr_mode) { if ((ufshcd_is_runtime_pm(pm_op) && !hba->auto_bkops_enabled) || !ufshcd_is_runtime_pm(pm_op)) { @@ -8690,7 +8692,6 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) } } - flush_work(&hba->eeh_work); ret = ufshcd_link_state_transition(hba, req_link_state, 1); if (ret) goto set_dev_active;