scsi: ufs: Avoid race condition between reinit and suspend

In rtb log,

[0.846068] [259400502] : LOGK_READL ufs_qcom_suspend
[0.846069] [259400523] : LOGK_WRITEL ufs_qcom_suspend
[0.847777] [259433318] : LOGK_WRITEL ufshcd_host_reset_and_restore
[0.847780] [259433389] : LOGK_READL ufshcd_host_reset_and_restore

This causes ufshcd reinit failure.
Add rm_runtime_get_sync() to avoid entering runtime_suspend.

Also use ufshcd_reset_and_restore to follow ufshcd_err_handler()
design.

Bug: 151321015
Test: Fault injection
Signed-off-by: Randall Huang <huangrandall@google.com>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Change-Id: I2a0ce8cb8b518794f6f5f6cad7cfb08f12807b06
fourteen
Randall Huang 5 years ago committed by Jenna
parent 2b9310ad9c
commit 39c1bc4f3f
  1. 4
      drivers/scsi/ufs/ufshcd.c

@ -10384,14 +10384,16 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
* Don't allow clock gating and hibern8 enter for faster device
* detection.
*/
pm_runtime_get_sync(hba->dev);
ufshcd_hold_all(hba);
ret = ufshcd_probe_hba(hba);
while (ret && retry) {
pr_err("%s failed. Err = %d. Retry %d\n", __func__, ret, retry);
ret = ufshcd_host_reset_and_restore(hba);
ret = ufshcd_reset_and_restore(hba);
retry--;
}
ufshcd_release_all(hba);
pm_runtime_put_sync(hba->dev);
ufshcd_extcon_register(hba);
}

Loading…
Cancel
Save