[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXCibwJ0jBYu3Cr3-hW-GykQ7UANeKo=qjJAbQTtmah3A@mail.gmail.com>
Date: Wed, 5 Jul 2023 16:44:22 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Yangtao Li <frank.li@...o.com>
Cc: Wolfram Sang <wsa+renesas@...g-engineering.com>,
Andi Shyti <andi.shyti@...nel.org>,
linux-renesas-soc@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/11] i2c: sh_mobile: Use devm_platform_get_and_ioremap_resource()
Hi Yangtao,
On Wed, Jul 5, 2023 at 3:56 PM Yangtao Li <frank.li@...o.com> wrote:
> Convert platform_get_resource(), devm_ioremap_resource() to a single
> call to devm_platform_get_and_ioremap_resource(), as this is exactly
> what this function does.
>
> Signed-off-by: Yangtao Li <frank.li@...o.com>
Thanks for your patch!
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -893,12 +893,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
> pd->dev = &dev->dev;
> platform_set_drvdata(dev, pd);
>
> - res = platform_get_resource(dev, IORESOURCE_MEM, 0);
> -
> - pd->res = res;
> - pd->reg = devm_ioremap_resource(&dev->dev, res);
> + pd->reg = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
"pdev" does not exist in this context.
Please try to at least compile-test your patches before submitting them.
> if (IS_ERR(pd->reg))
> return PTR_ERR(pd->reg);
> + pd->res = res;
While at it, you could get rid of "res", and replace it by "pd->res" in the
above call to devm_platform_get_and_ioremap_resource().
>
> ret = of_property_read_u32(dev->dev.of_node, "clock-frequency", &bus_speed);
> pd->bus_speed = (ret || !bus_speed) ? I2C_MAX_STANDARD_MODE_FREQ : bus_speed;
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