]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: ufs: core: Correct ufshcd_shutdown() flow
authorPeter Wang <peter.wang@mediatek.com>
Wed, 27 Jul 2022 03:05:26 +0000 (11:05 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:16 +0000 (14:24 +0200)
commit 59d93813c1b2b77b3ab69deeb2a1942e7523b0f5 upstream.

After ufshcd_wl_shutdown() set device power off and link off,
ufshcd_shutdown() could turn off clock/power. Also remove
pm_runtime_get_sync.

The reason why it is safe to remove pm_runtime_get_sync() is because:

 - ufshcd_wl_shutdown() -> pm_runtime_get_sync() will resume hba->dev too.

 - device resume(turn on clk/power) is not required, even if device is in
   RPM_SUSPENDED.

Link: https://lore.kernel.org/r/20220727030526.31022-1-peter.wang@mediatek.com
Fixes: 1799d66d7dd4 ("scsi: ufs: core: Enable power management for wlun")
Cc: <stable@vger.kernel.org> # 5.15.x
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/ufs/ufshcd.c

index 4a7248421bcd0d6a475966a8d7b96c093f4489d4..2f6468f22b48964739f56a35e93f745c9b6db1ac 100644 (file)
@@ -9239,12 +9239,8 @@ EXPORT_SYMBOL(ufshcd_runtime_resume);
 int ufshcd_shutdown(struct ufs_hba *hba)
 {
        if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
-               goto out;
-
-       pm_runtime_get_sync(hba->dev);
+               ufshcd_suspend(hba);
 
-       ufshcd_suspend(hba);
-out:
        hba->is_powered = false;
        /* allow force shutdown even in case of errors */
        return 0;