Re: [PATCH v7 2/3] scsi: ufs: core: Hold host_sem in ufshcd_wl_poweroff()

From: Bart Van Assche

Date: Fri Nov 06 2026 - 16:57:02 EST


On 11/5/26 10:11 PM, HOYOUNG SEO wrote:
> @@ -11574,6 +11574,8 @@ static int ufshcd_wl_poweroff(struct device *dev)
> struct scsi_device *sdev = to_scsi_device(dev);
> struct ufs_hba *hba = shost_priv(sdev->host);
>
> + /* Released by ufshcd_wl_resume() if hibernation is aborted. */
> + down(&hba->host_sem);
> __ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
> return 0;
> }

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>

As Sashiko pointed out, ufshcd_wl_poweroff() is still different from
ufshcd_wl_suspend() in other ways: it ignores the return value of
__ufshcd_wl_suspend(), it doesn't check pm_runtime_suspended(dev) and
it doesn't set hba->is_sys_suspended. This patch doesn't introduce any
of these issues, so I think they should be fixed separately. Please
consider a follow-up patch that makes ufshcd_wl_suspend() and
ufshcd_wl_poweroff() share a common helper function. Since returning an
error from the .poweroff callback aborts hibernation, that change should
be a separate patch with a commit message that explains the behavior
change.

Thanks,

Bart.