Re: [PATCH v3 11/12] i2c: designware: Move reg-space remapping into a dedicated function

From: Andy Shevchenko
Date: Wed May 27 2020 - 05:26:24 EST


On Wed, May 27, 2020 at 4:03 AM Serge Semin
<Sergey.Semin@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> This is a preparation patch before adding a quirk with custom registers
> map creation required for the Baikal-T1 System I2C support. Since we've
> touched this code anyway let's replace
> platform_get_resource()-devm_ioremap_resource() tuple with ready-to-use
> helper devm_platform_get_and_ioremap_resource().

...

> +static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev->dev);

> + int ret = 0;

Redundant.

> + dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);

What's the point of this API if you don't use resource parameter?

> + if (IS_ERR(dev->base))
> + ret = PTR_ERR(dev->base);
> +
> + return ret;

return PTR_ERR_OR_ZERO(dev->base);

> +}

> - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - dev->base = devm_ioremap_resource(&pdev->dev, mem);
> - if (IS_ERR(dev->base))
> - return PTR_ERR(dev->base);

Wolfram, did my last series make your tree? I think there was a patch
that touched this part...

--
With Best Regards,
Andy Shevchenko