Skip to contentSkip to conversation

drivers: mtd: nand: davinci: use devm_ioremap_resource()

PATCH Superseded Laurent Navet 2 participants 2 messages May 2, 2013

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: mtd: nand: davinci: use devm_ioremap_resource()

Replace a call to deprecated devm_request_and_ioremap by devm_ioremap_resource.

Found with coccicheck and this semantic patch:
scripts/coccinelle/api/devm_request_and_ioremap.cocci.

---
 drivers/mtd/nand/davinci_nand.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/mtd/nand/davinci_nand.c +8 -5
index 94e17af..4a96e58 100644
@@ -623,11 +623,14 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 		goto err_nomem;
 	}
 
-	vaddr = devm_request_and_ioremap(&pdev->dev, res1);
-	base = devm_request_and_ioremap(&pdev->dev, res2);
-	if (!vaddr || !base) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		ret = -EADDRNOTAVAIL;
+	vaddr = devm_ioremap_resource(&pdev->dev, res1);
+	base = devm_ioremap_resource(&pdev->dev, res2);
+	if (IS_ERR(vaddr)) {
+		ret = PTR_ERR(vaddr);
+		goto err_ioremap;
+	}
+	if (IS_ERR(base)) {
+		ret = PTR_ERR(base);
 		goto err_ioremap;
 	}
 
Signature · 1 line
1.7.10.4
#1 lore raw

Hello.

Quoted 15 lines · Laurent Navet

Replace a call to deprecated devm_request_and_ioremap by devm_ioremap_resource.

Found with coccicheck and this semantic patch:
scripts/coccinelle/api/devm_request_and_ioremap.cocci.

---
  drivers/mtd/nand/davinci_nand.c |   13 ++++++++-----
  1 file changed, 8 insertions(+), 5 deletions(-)
drivers/mtd/nand/davinci_nand.c +0 -0
index 94e17af..4a96e58 100644

drivers/mtd/nand/davinci_nand.c static int __init nand_davinci_probe(struct platform_device *pdev) · line 627

Quoted 10 lines
drivers/mtd/nand/davinci_nand.c +2 -5
@@ -623,11 +623,14 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
  		goto err_nomem;
  	}
 
-	vaddr = devm_request_and_ioremap(&pdev->dev, res1);
-	base = devm_request_and_ioremap(&pdev->dev, res2);
-	if (!vaddr || !base) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		ret = -EADDRNOTAVAIL;
+	vaddr = devm_ioremap_resource(&pdev->dev, res1);
+	base = devm_ioremap_resource(&pdev->dev, res2);

I'd rather put this line before its corresponding error check.

drivers/mtd/nand/davinci_nand.c static int __init nand_davinci_probe(struct platform_device *pdev) · line 635

Quoted 8 lines
drivers/mtd/nand/davinci_nand.c +6 -0
+	if (IS_ERR(vaddr)) {
+		ret = PTR_ERR(vaddr);
+		goto err_ioremap;
+	}
+	if (IS_ERR(base)) {
+		ret = PTR_ERR(base);
  		goto err_ioremap;
  	}

WBR, Sergei