Skip to contentSkip to conversation

ufs: core: correct ufshcd_shutdown flow

PATCH Applied [email protected] 3 participants 3 messages Jul 27, 2022 – Aug 1, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 ufs: core: correct ufshcd_shutdown flow

From: Peter Wang <[email protected]>

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 here can remove pm_runtime_get_sync is because,
(1) ufshcd_wl_shutdown -> pm_runtime_get_sync, will resume hba->dev too.
(2) device resume(turn on clk/power) is not required, even if device is in RPM_SUSPENDED.

Fixes b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun")
Cc <[email protected]> # 5.15.x
---
 drivers/ufs/core/ufshcd.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/ufs/core/ufshcd.c +1 -5
index c7b337480e3e..d13c76983555 100644
@@ -9462,12 +9462,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;
Signature · 1 line
2.18.0
Reviewed-by on v5 1/1
#1 lore raw
Quoted 6 lines · On Wed, Jul 27, 2022 at 11:10 AM <[email protected]> wrote:

From: Peter Wang <[email protected]>

After ufshcd_wl_shutdown set device power off and link off, ufshcd_shutdown could turn off clock/power.

Quoted 8 lines

Also remove pm_runtime_get_sync.
The reason why here can remove pm_runtime_get_sync is because,
(1) ufshcd_wl_shutdown -> pm_runtime_get_sync, will resume hba->dev too.
(2) device resume(turn on clk/power) is not required, even if device is in RPM_SUSPENDED.

Fixes b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun")
Cc <[email protected]> # 5.15.x
#2 lore raw
In reply to [email protected]
Quoted 3 lines

After ufshcd_wl_shutdown set device power off and link off, ufshcd_shutdown could turn off clock/power.

Applied to 5.20/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering