diff mbox series

clk: imx8qxp: Defer instead of failing probe

Message ID DU0PR01MB93828B0E6808E33C608BC0E29DD32@DU0PR01MB9382.eurprd01.prod.exchangelabs.com (mailing list archive)
State New
Headers show
Series clk: imx8qxp: Defer instead of failing probe | expand

Commit Message

Diogo Manuel Pais Silva July 1, 2024, 11:54 a.m. UTC
When of_clk_parent_fill is run before all the parent clocks have been probed then the probe function will return -EINVAL, making it so that the probe isn't attempted again. As fw_devlink is on by default this does not usually happen, but if fw_devlink is disabled then it is very possible that the parent clock will be probed after the lpcg first attempt, and the lpcg clock will not work.

Signed-off-by: Diogo Silva <diogo.pais@ttcontrol.com>
---
 drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.34.1

CONFIDENTIALITY: The contents of this e-mail are confidential and intended only for the above addressee(s). If you are not the intended recipient, or the person responsible for delivering it to the intended recipient, copying or delivering it to anyone else or using it in any unauthorized manner is prohibited and may be unlawful. If you receive this e-mail by mistake, please notify the sender and the systems administrator at straymail@tttech.com immediately.

TTControl - Internal

Comments

Peng Fan July 1, 2024, 11:55 p.m. UTC | #1
> Subject: [PATCH] clk: imx8qxp: Defer instead of failing probe
> 
> When of_clk_parent_fill is run before all the parent clocks have been
> probed then the probe function will return -EINVAL, making it so that
> the probe isn't attempted again. As fw_devlink is on by default this
> does not usually happen, but if fw_devlink is disabled then it is very
> possible that the parent clock will be probed after the lpcg first attempt,
> and the lpcg clock will not work.
> 
> Signed-off-by: Diogo Silva <diogo.pais@ttcontrol.com>
> ---
>  drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-
> imx8qxp-lpcg.c
> index d0ccaa040225..520a05ea0bef 100644
> --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> @@ -225,8 +225,8 @@ static int imx_lpcg_parse_clks_from_dt(struct
> platform_device *pdev,
> 
>         ret = of_clk_parent_fill(np, parent_names, count);
>         if (ret != count) {
> -               dev_err(&pdev->dev, "failed to get clock parent names\n");
> -               return count;
> +               dev_warn(&pdev->dev, "failed to get all clock parent
> names\n");
> +               return -EPROBE_DEFER;

Use dev_err_probe?

Regards,
Peng.

>         }
> 
>         ret = of_property_read_string_array(np, "clock-output-names",
> --
> 2.34.1
> 
> CONFIDENTIALITY: The contents of this e-mail are confidential and
> intended only for the above addressee(s). If you are not the intended
> recipient, or the person responsible for delivering it to the intended
> recipient, copying or delivering it to anyone else or using it in any
> unauthorized manner is prohibited and may be unlawful. If you receive
> this e-mail by mistake, please notify the sender and the systems
> administrator at straymail@tttech.com immediately.
> 
> TTControl - Internal
diff mbox series

Patch

diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
index d0ccaa040225..520a05ea0bef 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -225,8 +225,8 @@  static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev,

        ret = of_clk_parent_fill(np, parent_names, count);
        if (ret != count) {
-               dev_err(&pdev->dev, "failed to get clock parent names\n");
-               return count;
+               dev_warn(&pdev->dev, "failed to get all clock parent names\n");
+               return -EPROBE_DEFER;
        }

        ret = of_property_read_string_array(np, "clock-output-names",