Re: [PATCH 01/15] i2c: busses: emev2: Use devm_clk_get_enabled()

Geert Uytterhoeven
2023-06-12T07:47:30Z

Hi Andi,

On Mon, Jun 12, 2023 at 12:57 AM Andi Shyti <andi.shyti@kernel.org> wrote:
> Replace the pair of functions, devm_clk_get() and
> clk_prepare_enable(), with a single function
> devm_clk_get_enabled().
>
> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Magnus Damm <magnus.damm@gmail.com>

Thanks for your patch!

> --- a/drivers/i2c/busses/i2c-emev2.c
> +++ b/drivers/i2c/busses/i2c-emev2.c
> @@ -373,14 +373,10 @@ static int em_i2c_probe(struct platform_device *pdev)
>
> strscpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name));
>
> - priv->sclk = devm_clk_get(&pdev->dev, "sclk");
> + priv->sclk = devm_clk_get_enabled(&pdev->dev, "sclk");
> if (IS_ERR(priv->sclk))
> return PTR_ERR(priv->sclk);

After this, priv->sclk is unused, so you can replace em_i2c_device.sclk
by a local variable.

The rest LGTM.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-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