Commit b36c6b18 authored by Cai Huoqing's avatar Cai Huoqing Committed by Mark Brown

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: default avatarCai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210908105745.1984-1-caihuoqing@baidu.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c33e65cb
......@@ -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";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment