# \[PATCH 0/7\] replace devm\_request\_and\_ioremap by devm\_ioremap\_resource

- Subsystems: FRAMEBUFFER LAYER, ARM/STI ARCHITECTURE, DMA GENERIC OFFLOAD ENGINE SUBSYSTEM, IOMMU SUBSYSTEM, MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER, MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM, NETWORKING DRIVERS, PCI SUBSYSTEM, THE REST, TTY LAYER AND SERIAL DRIVERS
- Maintainers: Helge Deller, Patrice Chotard, Vinod Koul, Joerg Roedel, Will Deacon, Nicolas Pitre, Ulf Hansson, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Bjorn Helgaas, Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby
- Series: 7 patches touching 7 files, +37/-59
- List: linux-fbdev
- 3 messages, 2 authors
- Page: https://ratatoskr.run/linux-fbdev/2013/08/4102987/t

## \[PATCH 0/7\] replace devm\_request\_and\_ioremap by devm\_ioremap\_resource

- From: Julia Lawall \<hidden\>
- Date: 2013-08-19 11:21:09 
- Message: https://ratatoskr.run/linux-fbdev/2013/08/4102987.md

```text
devm_request_and_ioremap has been replaced by devm_ioremap_resource, which
gives more informative error return code information.  This patch series
removes the remaining uses of devm_request_and_ioremap.

This patch series was generated using the semantic patch
scripts/coccinelle/api/devm_ioremap_resource.cocci from the Linux kernel
source tree.  Manual modifications have been made to move associated calls
to platform_get_resource closer to the resulting call to
devm_ioremap_resource and to remove the associated error handling code.

```

## \[PATCH 6/7\] video: xilinxfb: replace devm\_request\_and\_ioremap by devm\_ioremap\_resource

- From: Julia Lawall \<hidden\>
- Date: 2013-08-19 11:21:08 
- Message: https://ratatoskr.run/linux-fbdev/2013/08/4102988.md

```text
From: Julia Lawall <redacted>

Use devm_ioremap_resource instead of devm_request_and_ioremap.

This was done using the semantic patch
scripts/coccinelle/api/devm_ioremap_resource.cocci

The initialization of drvdata->regs_phys was manually moved lower, to take
advantage of the NULL test on res performed by devm_ioremap_resource.

Signed-off-by: Julia Lawall <redacted>

---
 drivers/video/xilinxfb.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 6629b29..84c664e 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -259,12 +259,12 @@ static int xilinxfb_assign(struct platform_device *pdev,
 		struct resource *res;
 
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		drvdata->regs_phys = res->start;
-		drvdata->regs = devm_request_and_ioremap(&pdev->dev, res);
-		if (!drvdata->regs) {
-			rc = -EADDRNOTAVAIL;
+		drvdata->regs = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(drvdata->regs)) {
+			rc = PTR_ERR(drvdata->regs);
 			goto err_region;
 		}
+		drvdata->regs_phys = res->start;
 	}
 
 	/* Allocate the framebuffer memory */

```

## Re: \[PATCH 6/7\] video: xilinxfb: replace devm\_request\_and\_ioremap by devm\_ioremap\_resource

- From: Tomi Valkeinen \<hidden\>
- Date: 2013-08-30 09:42:37 
- Message: https://ratatoskr.run/linux-fbdev/2013/08/4109339.md

```text
On 19/08/13 14:20, Julia Lawall wrote:
> From: Julia Lawall <redacted>
> 
> Use devm_ioremap_resource instead of devm_request_and_ioremap.
> 
> This was done using the semantic patch
> scripts/coccinelle/api/devm_ioremap_resource.cocci
> 
> The initialization of drvdata->regs_phys was manually moved lower, to take
> advantage of the NULL test on res performed by devm_ioremap_resource.
> 
> Signed-off-by: Julia Lawall <redacted>
> 
> ---
>  drivers/video/xilinxfb.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
> index 6629b29..84c664e 100644
> --- a/drivers/video/xilinxfb.c
> +++ b/drivers/video/xilinxfb.c
> @@ -259,12 +259,12 @@ static int xilinxfb_assign(struct platform_device *pdev,
>  		struct resource *res;
>  
>  		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -		drvdata->regs_phys = res->start;
> -		drvdata->regs = devm_request_and_ioremap(&pdev->dev, res);
> -		if (!drvdata->regs) {
> -			rc = -EADDRNOTAVAIL;
> +		drvdata->regs = devm_ioremap_resource(&pdev->dev, res);
> +		if (IS_ERR(drvdata->regs)) {
> +			rc = PTR_ERR(drvdata->regs);
>  			goto err_region;
>  		}
> +		drvdata->regs_phys = res->start;
>  	}
>  
>  	/* Allocate the framebuffer memory */

Thanks, queued for 3.12.

 Tomi



```
