diff mbox

[6/7] video: xilinxfb: replace devm_request_and_ioremap by devm_ioremap_resource

Message ID 1376911241-27720-7-git-send-email-Julia.Lawall@lip6.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Julia Lawall Aug. 19, 2013, 11:20 a.m. UTC
From: Julia Lawall <Julia.Lawall@lip6.fr>

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 <Julia.Lawall@lip6.fr>

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


--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tomi Valkeinen Aug. 30, 2013, 9:42 a.m. UTC | #1
On 19/08/13 14:20, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> 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 <Julia.Lawall@lip6.fr>
> 
> ---
>  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
diff mbox

Patch

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 */