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 <andriy.shevchenko@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
Andy Shevchenko 2019-11-15 10:49:30 +02:00 committed by Lee Jones
parent 18490cdb9e
commit f2a19c5b78

View File

@ -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);