diff options
author | Cai Huoqing <caihuoqing@baidu.com> | 2021-09-08 12:57:44 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-09-13 02:59:22 +0200 |
commit | b36c6b1887ffc6b58b556120bfbd511880515247 (patch) | |
tree | 23d7762c9aebce371fa4d45f4e504b03da21cda1 /drivers/regulator/ti-abb-regulator.c | |
parent | Merge existing fixes from regulator/for-5.15 (diff) | |
download | linux-b36c6b1887ffc6b58b556120bfbd511880515247.tar.xz linux-b36c6b1887ffc6b58b556120bfbd511880515247.zip |
regulator: ti-abb: Make use of the helper function devm_ioremap related
Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap/devm_ioremap_resource()
separately
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210908105745.1984-1-caihuoqing@baidu.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/ti-abb-regulator.c')
-rw-r--r-- | drivers/regulator/ti-abb-regulator.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c index 9f0a4d50cead..2931a0b89bff 100644 --- a/drivers/regulator/ti-abb-regulator.c +++ b/drivers/regulator/ti-abb-regulator.c @@ -725,9 +725,7 @@ static int ti_abb_probe(struct platform_device *pdev) /* Map ABB resources */ if (abb->regs->setup_off || abb->regs->control_off) { - pname = "base-address"; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); - abb->base = devm_ioremap_resource(dev, res); + abb->base = devm_platform_ioremap_resource_byname(pdev, "base-address"); if (IS_ERR(abb->base)) return PTR_ERR(abb->base); @@ -735,35 +733,18 @@ static int ti_abb_probe(struct platform_device *pdev) abb->control_reg = abb->base + abb->regs->control_off; } else { - pname = "control-address"; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); - abb->control_reg = devm_ioremap_resource(dev, res); + abb->control_reg = devm_platform_ioremap_resource_byname(pdev, "control-address"); if (IS_ERR(abb->control_reg)) return PTR_ERR(abb->control_reg); - pname = "setup-address"; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); - abb->setup_reg = devm_ioremap_resource(dev, res); + abb->setup_reg = devm_platform_ioremap_resource_byname(pdev, "setup-address"); if (IS_ERR(abb->setup_reg)) return PTR_ERR(abb->setup_reg); } - pname = "int-address"; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname); - if (!res) { - dev_err(dev, "Missing '%s' IO resource\n", pname); - return -ENODEV; - } - /* - * We may have shared interrupt register offsets which are - * write-1-to-clear between domains ensuring exclusivity. - */ - abb->int_base = devm_ioremap(dev, res->start, - resource_size(res)); - if (!abb->int_base) { - dev_err(dev, "Unable to map '%s'\n", pname); - return -ENOMEM; - } + abb->int_base = devm_platform_ioremap_resource_byname(pdev, "int-address"); + if (IS_ERR(abb->int_base)) + return PTR_ERR(abb->int_base); /* Map Optional resources */ pname = "efuse-address"; |