[PATCH 6/6] soc: ixp4xx/npe: Use devm_platform_get_and_ioremap_resource()

From: Yangtao Li
Date: Wed Jul 05 2023 - 08:27:20 EST


Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
---
drivers/soc/ixp4xx/ixp4xx-npe.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c
index 5be9988f30ce..67384031ef97 100644
--- a/drivers/soc/ixp4xx/ixp4xx-npe.c
+++ b/drivers/soc/ixp4xx/ixp4xx-npe.c
@@ -700,9 +700,9 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
for (i = 0; i < NPE_COUNT; i++) {
struct npe *npe = &npe_tab[i];

- res = platform_get_resource(pdev, IORESOURCE_MEM, i);
- if (!res)
- return -ENODEV;
+ npe->regs = devm_platform_get_and_ioremap_resource(pdev, i, &res);
+ if (IS_ERR(npe->regs))
+ return PTR_ERR(npe->regs);

val = cpu_ixp4xx_features(rmap);

@@ -711,9 +711,6 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
i, res);
continue; /* NPE already disabled or not present */
}
- npe->regs = devm_ioremap_resource(dev, res);
- if (IS_ERR(npe->regs))
- return PTR_ERR(npe->regs);
npe->rmap = rmap;

if (npe_reset(npe)) {
--
2.39.0