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

Message ID 20230705122644.32236-6-frank.li@vivo.com
State New
Headers
Series [1/6] soc: ti: omap-prm: Use devm_platform_get_and_ioremap_resource() |

Commit Message

李扬韬 July 5, 2023, 12:26 p.m. UTC
  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@vivo.com>
---
 drivers/soc/ixp4xx/ixp4xx-npe.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
  

Patch

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)) {