Skip to content

Commit 6bc5e70

Browse files
ptr324martinkpetersen
authored andcommitted
scsi: ufs: core: WLUN suspend dev/link state error recovery
When wl suspend error occurs, for example BKOP or SSU timeout, the host triggers an error handler and returns -EBUSY to break the wl suspend process. However, it is possible for the runtime PM to enter wl suspend again before the error handler has finished, and return -EINVAL because the device is in an error state. To address this, ensure that the rumtime PM waits for the error handler to finish, or trigger the error handler in such cases, because returning -EINVAL can cause the I/O to hang. Signed-off-by: Peter Wang <peter.wang@mediatek.com> Link: https://lore.kernel.org/r/20240329015036.15707-1-peter.wang@mediatek.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 1197c5b commit 6bc5e70

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/ufs/core/ufshcd.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9791,7 +9791,10 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
97919791

97929792
/* UFS device & link must be active before we enter in this function */
97939793
if (!ufshcd_is_ufs_dev_active(hba) || !ufshcd_is_link_active(hba)) {
9794-
ret = -EINVAL;
9794+
/* Wait err handler finish or trigger err recovery */
9795+
if (!ufshcd_eh_in_progress(hba))
9796+
ufshcd_force_error_recovery(hba);
9797+
ret = -EBUSY;
97959798
goto enable_scaling;
97969799
}
97979800

0 commit comments

Comments
 (0)