Re: [PATCH v1 1/2] mfd: syscon: Re-use resource_size() to count max_register
From: Arnd Bergmann
Date: Fri Nov 15 2019 - 04:11:21 EST
On Fri, Nov 15, 2019 at 9:49 AM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> Instead of open coded variant use resource_size() and replace
> weird '- 3' to more understandable '- 4'.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
> drivers/mfd/syscon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
> index e22197c832e8..13626bb2d432 100644
> --- a/drivers/mfd/syscon.c
> +++ b/drivers/mfd/syscon.c
> @@ -245,7 +245,7 @@ static int syscon_probe(struct platform_device *pdev)
> if (!base)
> return -ENOMEM;
>
> - syscon_config.max_register = res->end - res->start - 3;
> + syscon_config.max_register = resource_size(res) - 4;
> if (pdata)
> syscon_config.name = pdata->label;
> syscon->regmap = devm_regmap_init_mmio(dev, base, &syscon_config);
> --
> 2.24.0
>