mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-08 15:04:45 +00:00
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>
This commit is contained in:
parent
c33e65cbbd
commit
b36c6b1887
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user