From: Andy Shevchenko Date: Fri, 15 Nov 2019 08:49:30 +0000 (+0200) Subject: mfd: syscon: Re-use resource_size() to count max_register X-Git-Tag: v5.10.7~3314^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2a19c5b78670af5986ab0a625631f8f8a6adac1;p=platform%2Fkernel%2Flinux-rpi.git mfd: syscon: Re-use resource_size() to count max_register Instead of open coded variant use resource_size() and replace weird '- 3' to more understandable '- 4'. Signed-off-by: Andy Shevchenko Acked-by: Arnd Bergmann Signed-off-by: Lee Jones --- diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index e22197c..13626bb 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);