diff mbox series

[v2] EDAC/xgene: Use devm_platform_ioremap_resource() in xgene_edac_probe()

Message ID 6e6ce5f8-b701-4660-a71b-478b29197a21@web.de (mailing list archive)
State New
Headers show
Series [v2] EDAC/xgene: Use devm_platform_ioremap_resource() in xgene_edac_probe() | expand

Commit Message

Markus Elfring Feb. 6, 2024, 4:34 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 6 Feb 2024 17:30:11 +0100

A wrapper function is available since the commit 7945f929f1a77a1c8887a97ca07f87626858ff42
("drivers: provide devm_platform_ioremap_resource()").

* Thus reuse existing functionality instead of keeping duplicate source code.

* Delete a local variable which became unnecessary with this refactoring.


This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

v2:
The transformation pattern was adjusted based on advices by known contributors.

Examples:
* Doug Anderson
* Geert Uytterhoeven
* Robin Murphy


 drivers/edac/xgene_edac.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--
2.43.0
diff mbox series

Patch

diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c
index 1b50f8160013..59eb0e97adef 100644
--- a/drivers/edac/xgene_edac.c
+++ b/drivers/edac/xgene_edac.c
@@ -1845,7 +1845,6 @@  static int xgene_edac_probe(struct platform_device *pdev)
 {
 	struct xgene_edac *edac;
 	struct device_node *child;
-	struct resource *res;
 	int rc;

 	edac = devm_kzalloc(&pdev->dev, sizeof(*edac), GFP_KERNEL);
@@ -1903,8 +1902,7 @@  static int xgene_edac_probe(struct platform_device *pdev)
 		edac->rb_map = NULL;
 	}

-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	edac->pcp_csr = devm_ioremap_resource(&pdev->dev, res);
+	edac->pcp_csr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(edac->pcp_csr)) {
 		dev_err(&pdev->dev, "no PCP resource address\n");
 		rc = PTR_ERR(edac->pcp_csr);