Skip to contentSkip to conversation

pci: convert to devm_ioremap_resource()

PATCH In review Silviu-Mihai Popescu 3 participants 4 messages Mar 11, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: 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.

---
 arch/mips/pci/pci-ar724x.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/mips/pci/pci-ar724x.c +9 -9
index 8a0700d..65ec032 100644
@@ -365,25 +365,25 @@ static int ar724x_pci_probe(struct platform_device *pdev)
 	if (!res)
 		return -EINVAL;
 
-	apc->ctrl_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (apc->ctrl_base == NULL)
-		return -EBUSY;
+	apc->ctrl_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(apc->ctrl_base))
+		return PTR_ERR(apc->ctrl_base);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
 	if (!res)
 		return -EINVAL;
 
-	apc->devcfg_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!apc->devcfg_base)
-		return -EBUSY;
+	apc->devcfg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(apc->devcfg_base))
+		return PTR_ERR(apc->devcfg_base);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crp_base");
 	if (!res)
 		return -EINVAL;
 
-	apc->crp_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (apc->crp_base == NULL)
-		return -EBUSY;
+	apc->crp_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(apc->crp_base))
+		return PTR_ERR(apc->crp_base);
 
 	apc->irq = platform_get_irq(pdev, 0);
 	if (apc->irq < 0)
Signature · 1 line
1.7.9.5
Acked-by on v1 1/1
#1 lore raw

2013.03.11. 8:42 keltezéssel, Silviu-Mihai Popescu írta:

Quoted 10 lines

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.

---
 arch/mips/pci/pci-ar724x.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Just a minor note, arch/mips/pci/pci-ar71xx.c should be fixed as well probably.

#2 lore raw
Quoted 7 lines · Gabor Juhos

2013.03.11. 8:42 keltezéssel, Silviu-Mihai Popescu írta:

Quoted 6 lines

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 10 lines
Quoted 4 lines
---
  arch/mips/pci/pci-ar724x.c |   18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)

Just a minor note, arch/mips/pci/pci-ar71xx.c should be fixed as well probably.

Hi,

is this patch supposed to go upstream via linux-mips.org ?

John

#3 lore raw

2013.03.11. 10:58 keltezéssel, John Crispin írta:

Quoted 15 lines · Gabor Juhos
Quoted 14 lines

2013.03.11. 8:42 keltezéssel, Silviu-Mihai Popescu írta:

Quoted 10 lines

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.

---
  arch/mips/pci/pci-ar724x.c |   18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
Quoted 8 lines
Quoted 3 lines

Just a minor note, arch/mips/pci/pci-ar71xx.c should be fixed as well probably.

Hi,

is this patch supposed to go upstream via linux-mips.org ?

Yes, IMHO.

-Gabor