[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <493c140d-9519-fcff-7d8d-515c0aec7aea@kali.org>
Date: Sat, 30 Jul 2022 01:42:13 -0500
From: Steev Klimaszewski <steev@...i.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
bjorn.andersson@...aro.org
Cc: linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
Abel Vesa <abel.vesa@...aro.org>
Subject: Re: [PATCH] remoteproc: qcom_q6v5_pas: Do not fail if regulators are
not found
On 7/30/22 1:28 AM, Manivannan Sadhasivam wrote:
> devm_regulator_get_optional() API will return -ENODEV if the regulator was
> not found. For the optional supplies CX, PX we should not fail in that case
> but rather continue. So let's catch that error and continue silently if
> those regulators are not found.
>
> The commit 3f52d118f992 ("remoteproc: qcom_q6v5_pas: Deal silently with
> optional px and cx regulators") was supposed to do the same but it missed
> the fact that devm_regulator_get_optional() API returns -ENODEV when the
> regulator was not found.
>
> Cc: Abel Vesa <abel.vesa@...aro.org>
> Fixes: 3f52d118f992 ("remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators")
> Reported-by: Steev Klimaszewski <steev@...i.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
> ---
> drivers/remoteproc/qcom_q6v5_pas.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
> index 98f133f9bb60..5bf69ef53819 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -362,12 +362,24 @@ static int adsp_init_clock(struct qcom_adsp *adsp)
> static int adsp_init_regulator(struct qcom_adsp *adsp)
> {
> adsp->cx_supply = devm_regulator_get_optional(adsp->dev, "cx");
> - if (IS_ERR(adsp->cx_supply))
> - return PTR_ERR(adsp->cx_supply);
> + if (IS_ERR(adsp->cx_supply)) {
> + /* Do not fail if the regulator is not found */
> + if (PTR_ERR(adsp->cx_supply) == -ENODEV)
> + adsp->cx_supply = NULL;
> + else
> + return PTR_ERR(adsp->cx_supply);
> + }
>
> - regulator_set_load(adsp->cx_supply, 100000);
> + if (adsp->cx_supply)
> + regulator_set_load(adsp->cx_supply, 100000);
>
> adsp->px_supply = devm_regulator_get_optional(adsp->dev, "px");
> + if (IS_ERR(adsp->px_supply)) {
> + /* Do not fail if the regulator is not found */
> + if (PTR_ERR(adsp->px_supply) == -ENODEV)
> + adsp->px_supply = NULL;
> + }
> +
> return PTR_ERR_OR_ZERO(adsp->px_supply);
> }
>
Tested on the Lenovo Thinkpad X13s
Tested-by: Steev Klimaszewski <steev@...i.org>
Powered by blists - more mailing lists