[PATCH v1] ufs: core: fix deadlock when rtc update

Avri Altman Avri.Altman at wdc.com
Fri Jul 12 03:33:32 PDT 2024


> @@ -8188,8 +8188,15 @@ static void ufshcd_rtc_work(struct work_struct
> *work)
> 
>         hba = container_of(to_delayed_work(work), struct ufs_hba,
> ufs_rtc_update_work);
Will returning here If (!ufshcd_is_ufs_dev_active(hba)) works?
And remove it in the 2nd if clause?

Thanks,
Avri
> 
> -        /* Update RTC only when there are no requests in progress and UFSHCI is
> operational */
> -       if (!ufshcd_is_ufs_dev_busy(hba) && hba->ufshcd_state ==
> UFSHCD_STATE_OPERATIONAL)
> +        /*
> +         * Update RTC only when
> +         * 1. there are no requests in progress
> +         * 2. UFSHCI is operational
> +         * 3. pm operation is not in progress
> +         */
> +       if (!ufshcd_is_ufs_dev_busy(hba) &&
> +           hba->ufshcd_state == UFSHCD_STATE_OPERATIONAL &&
> +           !hba->pm_op_in_progress)
>                 ufshcd_update_rtc(hba);
> 
>         if (ufshcd_is_ufs_dev_active(hba) && hba->dev_info.rtc_update_period)
> --
> 2.18.0




More information about the Linux-mediatek mailing list