Re: [PATCH 08/11] i2c: sh_mobile: Use devm_platform_get_and_ioremap_resource()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Yangtao,

On Wed, Jul 5, 2023 at 3:56 PM Yangtao Li <frank.li@xxxxxxxx> 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@xxxxxxxx>

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@xxxxxxxxxxxxxx

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



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux