Re: [PATCH v1 08/10] bus: mhi: core: Move to an error state on any firmware load failure

From: Manivannan Sadhasivam
Date: Fri Oct 09 2020 - 12:42:54 EST


On Fri, Sep 18, 2020 at 07:02:33PM -0700, Bhaumik Bhatt wrote:
> Move MHI to a firmware download error state for a failure to find
> the firmware files or to load SBL or EBL image using BHI/BHIe. This
> helps detect an error state sooner and shortens the wait for a
> synchronous power up timeout.
>
> Signed-off-by: Bhaumik Bhatt <bbhatt@xxxxxxxxxxxxxx>
> ---
> drivers/bus/mhi/core/boot.c | 43 +++++++++++++++++++++++++------------------
> 1 file changed, 25 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c
> index 92b8dd3..fcc71f2 100644
> --- a/drivers/bus/mhi/core/boot.c
> +++ b/drivers/bus/mhi/core/boot.c

[...]

> -error_read:
> +error_ready_state:
> mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image);
> mhi_cntrl->fbc_image = NULL;
>
> -error_alloc_fw_table:
> - release_firmware(firmware);
> +error_fw_load:
> + write_lock_irq(&mhi_cntrl->pm_lock);
> + mhi_cntrl->pm_state = MHI_PM_FW_DL_ERR;
> + wake_up_all(&mhi_cntrl->state_event);

Do you really need pm_lock for this?

Thanks,
Mani

> + write_unlock_irq(&mhi_cntrl->pm_lock);
> }
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>