Re: [PATCH v4 02/10] scsi: ufs: Add flags pm_op_in_progress and is_sys_suspended

From: Bart Van Assche
Date: Thu Jun 24 2021 - 13:35:40 EST


On 6/23/21 12:35 AM, Can Guo wrote:
> @@ -9141,6 +9143,8 @@ static int ufshcd_suspend(struct ufs_hba *hba)
>
> if (!hba->is_powered)
> return 0;
> +
> + hba->pm_op_in_progress = true;
> /*
> * Disable the host irq as host controller as there won't be any
> * host controller transaction expected till resume.
> @@ -9160,6 +9164,7 @@ static int ufshcd_suspend(struct ufs_hba *hba)
> ufshcd_vreg_set_lpm(hba);
> /* Put the host controller in low power mode if possible */
> ufshcd_hba_vreg_set_lpm(hba);
> + hba->pm_op_in_progress = false;
> return ret;
> }
>
> @@ -9179,6 +9184,7 @@ static int ufshcd_resume(struct ufs_hba *hba)
> if (!hba->is_powered)
> return 0;
>
> + hba->pm_op_in_progress = true;
> ufshcd_hba_vreg_set_hpm(hba);
> ret = ufshcd_vreg_set_hpm(hba);
> if (ret)
> @@ -9198,6 +9204,7 @@ static int ufshcd_resume(struct ufs_hba *hba)
> out:
> if (ret)
> ufshcd_update_evt_hist(hba, UFS_EVT_RESUME_ERR, (u32)ret);
> + hba->pm_op_in_progress = false;
> return ret;
> }

Has it been considered to check dev->power.runtime_status instead of
introducing the pm_op_in_progress variable?

Thanks,

Bart.