Skip to contentSkip to conversation

omap: convert to devm_ioremap_resource()

PATCH Applied Silviu-Mihai Popescu 4 participants 7 messages Mar 11, 2013 – Mar 12, 2013

Subsystems (2)

v1 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap: convert to devm_ioremap_resource()

Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.

---
 sound/soc/omap/omap-dmic.c  |    9 +++------
 sound/soc/omap/omap-mcpdm.c |    8 +++-----
 2 files changed, 6 insertions(+), 11 deletions(-)
sound/soc/omap/omap-dmic.c +3 -6
index 77e9e7e..8ebaf11 100644
@@ -493,12 +493,9 @@ static int asoc_dmic_probe(struct platform_device *pdev)
 		goto err_put_clk;
 	}
 
-	dmic->io_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!dmic->io_base) {
-		dev_err(&pdev->dev, "cannot remap\n");
-		ret = -ENOMEM;
-		goto err_put_clk;
-	}
+	dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(dmic->io_base))
+		return PTR_ERR(dmic->io_base);
 
 	ret = snd_soc_register_dai(&pdev->dev, &omap_dmic_dai);
 	if (ret)
sound/soc/omap/omap-mcpdm.c +3 -5
index 079f277..ddfcc18 100644
@@ -464,11 +464,9 @@ static int asoc_mcpdm_probe(struct platform_device *pdev)
 	if (res == NULL)
 		return -ENOMEM;
 
-	mcpdm->io_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!mcpdm->io_base) {
-		dev_err(&pdev->dev, "cannot remap\n");
-		return -ENOMEM;
-	}
+	mcpdm->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(mcpdm->io_base))
+		return PTR_ERR(mcpdm->io_base);
 
 	mcpdm->irq = platform_get_irq(pdev, 0);
 	if (mcpdm->irq < 0)
Signature · 1 line
1.7.9.5
Acked-by on v1 1/1
#1 lore raw

Hi

Quoted 12 lines · Silviu-Mihai Popescu

Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.

---
 sound/soc/omap/omap-dmic.c  |    9 +++------
 sound/soc/omap/omap-mcpdm.c |    8 +++-----
 2 files changed, 6 insertions(+), 11 deletions(-)
#2 lore raw
In reply to Silviu-Mihai Popescu

Hi,

Quoted 5 lines · Silviu-Mihai Popescu

Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.

I believe both of the drivers has been patched for this:
omap-mcbpdm:
http://mailman.alsa-project.org/pipermail/alsa-devel/2013-February/059484.html
http://mailman.alsa-project.org/pipermail/alsa-devel/2013-February/059427.html

omap-dmic:
http://mailman.alsa-project.org/pipermail/alsa-devel/2013-February/059485.html

and they should be already queued for next.

Signature · 1 line
Péter
Quoted 47 lines
---
 sound/soc/omap/omap-dmic.c  |    9 +++------
 sound/soc/omap/omap-mcpdm.c |    8 +++-----
 2 files changed, 6 insertions(+), 11 deletions(-)
sound/soc/omap/omap-dmic.c +3 -6
index 77e9e7e..8ebaf11 100644
@@ -493,12 +493,9 @@ static int asoc_dmic_probe(struct platform_device *pdev)
 		goto err_put_clk;
 	}
 
-	dmic->io_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!dmic->io_base) {
-		dev_err(&pdev->dev, "cannot remap\n");
-		ret = -ENOMEM;
-		goto err_put_clk;
-	}
+	dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(dmic->io_base))
+		return PTR_ERR(dmic->io_base);
 
 	ret = snd_soc_register_dai(&pdev->dev, &omap_dmic_dai);
 	if (ret)
sound/soc/omap/omap-mcpdm.c +3 -5
index 079f277..ddfcc18 100644
@@ -464,11 +464,9 @@ static int asoc_mcpdm_probe(struct platform_device *pdev)
 	if (res == NULL)
 		return -ENOMEM;
 
-	mcpdm->io_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!mcpdm->io_base) {
-		dev_err(&pdev->dev, "cannot remap\n");
-		return -ENOMEM;
-	}
+	mcpdm->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(mcpdm->io_base))
+		return PTR_ERR(mcpdm->io_base);
 
 	mcpdm->irq = platform_get_irq(pdev, 0);
 	if (mcpdm->irq < 0)
#3 lore raw
Quoted 14 lines · Peter Ujfalusi

Hi,

Quoted 5 lines · Silviu-Mihai Popescu

Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.

I believe both of the drivers has been patched for this:
omap-mcbpdm:
http://mailman.alsa-project.org/pipermail/alsa-devel/2013-February/059484.html
http://mailman.alsa-project.org/pipermail/alsa-devel/2013-February/059427.html

Quoted 4 lines

omap-dmic:
http://mailman.alsa-project.org/pipermail/alsa-devel/2013-February/059485.html

and they should be already queued for next.

Hello,

As far as I can tell from the mails that you have provided, those patches replace devm_request_mem_region(), followed by devm_ioremap() with devm_request_and_ioremap().
What this patch attempts to do is replace devm_request_and_ioremap() with the newly introduced devm_ioremap_resource(), for the reasons expressed in the patch body.

Thanks,
Silviu

#4 lore raw
Quoted 6 lines · Silviu Popescu

As far as I can tell from the mails that you have provided, those patches replace devm_request_mem_region(), followed by devm_ioremap() with devm_request_and_ioremap().
What this patch attempts to do is replace devm_request_and_ioremap() with the newly introduced devm_ioremap_resource(), for the reasons expressed in the patch body.

Ah, true.

Signature · 5 lines
Péter
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Acked-by on v1 1/1
#5 lore raw
In reply to Silviu-Mihai Popescu
Quoted 5 lines · Silviu-Mihai Popescu

Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.

Quoted 47 lines
---
 sound/soc/omap/omap-dmic.c  |    9 +++------
 sound/soc/omap/omap-mcpdm.c |    8 +++-----
 2 files changed, 6 insertions(+), 11 deletions(-)
sound/soc/omap/omap-dmic.c +3 -6
index 77e9e7e..8ebaf11 100644
@@ -493,12 +493,9 @@ static int asoc_dmic_probe(struct platform_device *pdev)
 		goto err_put_clk;
 	}
 
-	dmic->io_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!dmic->io_base) {
-		dev_err(&pdev->dev, "cannot remap\n");
-		ret = -ENOMEM;
-		goto err_put_clk;
-	}
+	dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(dmic->io_base))
+		return PTR_ERR(dmic->io_base);
 
 	ret = snd_soc_register_dai(&pdev->dev, &omap_dmic_dai);
 	if (ret)
sound/soc/omap/omap-mcpdm.c +3 -5
index 079f277..ddfcc18 100644
@@ -464,11 +464,9 @@ static int asoc_mcpdm_probe(struct platform_device *pdev)
 	if (res == NULL)
 		return -ENOMEM;
 
-	mcpdm->io_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!mcpdm->io_base) {
-		dev_err(&pdev->dev, "cannot remap\n");
-		return -ENOMEM;
-	}
+	mcpdm->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(mcpdm->io_base))
+		return PTR_ERR(mcpdm->io_base);
 
 	mcpdm->irq = platform_get_irq(pdev, 0);
 	if (mcpdm->irq < 0)
Signature · 1 line
Péter
Applied
#6 lore raw
In reply to Silviu-Mihai Popescu
Quoted 5 lines · Silviu-Mihai Popescu

Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths.

Applied, thanks. Please use subject lines appropriate to the subsystem.