[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdW-Dp0TLixZMOcZfe9U05GKZY7S-wvNGCvzL=WVeZWeWw@mail.gmail.com>
Date: Tue, 25 Jul 2023 09:49:58 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Linus Walleij <linus.walleij@...aro.org>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, linux-gpio@...r.kernel.org
Subject: Re: [PATCH] pinctrl: renesas: rzg2l: Use devm_clk_get_enabled() helper
Hi Christophe,
On Sat, Jul 22, 2023 at 10:42 PM Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
> The devm_clk_get_enabled() helper:
> - calls devm_clk_get()
> - calls clk_prepare_enable() and registers what is needed in order to
> call clk_disable_unprepare() when needed, as a managed resource.
>
> This simplifies the code and avoids the need of a dedicated function used
> with devm_add_action_or_reset().
>
> While at it, use dev_err_probe() which filters -EPROBE_DEFER.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Thanks for your patch!
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -1471,11 +1471,6 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl)
> return 0;
> }
>
> -static void rzg2l_pinctrl_clk_disable(void *data)
> -{
> - clk_disable_unprepare(data);
> -}
> -
> static int rzg2l_pinctrl_probe(struct platform_device *pdev)
> {
> struct rzg2l_pinctrl *pctrl;
> @@ -1501,33 +1496,16 @@ static int rzg2l_pinctrl_probe(struct platform_device *pdev)
> if (IS_ERR(pctrl->base))
> return PTR_ERR(pctrl->base);
>
> - pctrl->clk = devm_clk_get(pctrl->dev, NULL);
> - if (IS_ERR(pctrl->clk)) {
> - ret = PTR_ERR(pctrl->clk);
> - dev_err(pctrl->dev, "failed to get GPIO clk : %i\n", ret);
> - return ret;
> - }
> + pctrl->clk = devm_clk_get_enabled(pctrl->dev, NULL);
clk can become a local variable now.
> + if (IS_ERR(pctrl->clk))
> + return dev_err_probe(pctrl->dev, PTR_ERR(pctrl->clk),
> + "failed to get GPIO clk\n");
failed to enable
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
i.e. will queue in renesas-clk-for-v6.6 with the above changes.
No need to resend.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists