diff mbox

fbdev: jz4740: Use devm_request_and_ioremap

Message ID 1347205121-5551-1-git-send-email-lars@metafoo.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lars-Peter Clausen Sept. 9, 2012, 3:38 p.m. UTC
Use devm_request_and_ioremap instead of request_mem_region + devm_ioremap.

This also fixes the following compile error introduced in commit b2ca7f4d
("drivers/video/jz4740_fb.c: use devm_ functions"):

drivers/video/jz4740_fb.c: In function 'jzfb_probe':
	drivers/video/jz4740_fb.c:676:2: error: implicit declaration of function 'devm_ioremap'
	drivers/video/jz4740_fb.c:676:13: warning: assignment makes pointer from integer without a cast

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/video/jz4740_fb.c |   24 +++---------------------
 1 files changed, 3 insertions(+), 21 deletions(-)

Comments

Florian Tobias Schandinat Sept. 23, 2012, 7:44 p.m. UTC | #1
On 09/09/2012 03:38 PM, Lars-Peter Clausen wrote:
> Use devm_request_and_ioremap instead of request_mem_region + devm_ioremap.
> 
> This also fixes the following compile error introduced in commit b2ca7f4d
> ("drivers/video/jz4740_fb.c: use devm_ functions"):
> 
> drivers/video/jz4740_fb.c: In function 'jzfb_probe':
> 	drivers/video/jz4740_fb.c:676:2: error: implicit declaration of function 'devm_ioremap'
> 	drivers/video/jz4740_fb.c:676:13: warning: assignment makes pointer from integer without a cast
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

Applied. Thanks for pointing this out and fixing it.


Best regards,

Florian Tobias Schandinat

> ---
>  drivers/video/jz4740_fb.c |   24 +++---------------------
>  1 files changed, 3 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
> index 7669770..b0df279 100644
> --- a/drivers/video/jz4740_fb.c
> +++ b/drivers/video/jz4740_fb.c
> @@ -632,23 +632,10 @@ static int __devinit jzfb_probe(struct platform_device *pdev)
>  		return -ENXIO;
>  	}
>  
> -	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!mem) {
> -		dev_err(&pdev->dev, "Failed to get register memory resource\n");
> -		return -ENXIO;
> -	}
> -
> -	mem = request_mem_region(mem->start, resource_size(mem), pdev->name);
> -	if (!mem) {
> -		dev_err(&pdev->dev, "Failed to request register memory region\n");
> -		return -EBUSY;
> -	}
> -
>  	fb = framebuffer_alloc(sizeof(struct jzfb), &pdev->dev);
>  	if (!fb) {
>  		dev_err(&pdev->dev, "Failed to allocate framebuffer device\n");
> -		ret = -ENOMEM;
> -		goto err_release_mem_region;
> +		return -ENOMEM;
>  	}
>  
>  	fb->fbops = &jzfb_ops;
> @@ -657,7 +644,6 @@ static int __devinit jzfb_probe(struct platform_device *pdev)
>  	jzfb = fb->par;
>  	jzfb->pdev = pdev;
>  	jzfb->pdata = pdata;
> -	jzfb->mem = mem;
>  
>  	jzfb->ldclk = devm_clk_get(&pdev->dev, "lcd");
>  	if (IS_ERR(jzfb->ldclk)) {
> @@ -673,9 +659,9 @@ static int __devinit jzfb_probe(struct platform_device *pdev)
>  		goto err_framebuffer_release;
>  	}
>  
> -	jzfb->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
> +	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	jzfb->base = devm_request_and_ioremap(&pdev->dev, mem);
>  	if (!jzfb->base) {
> -		dev_err(&pdev->dev, "Failed to ioremap register memory region\n");
>  		ret = -EBUSY;
>  		goto err_framebuffer_release;
>  	}
> @@ -736,8 +722,6 @@ err_free_devmem:
>  	jzfb_free_devmem(jzfb);
>  err_framebuffer_release:
>  	framebuffer_release(fb);
> -err_release_mem_region:
> -	release_mem_region(mem->start, resource_size(mem));
>  	return ret;
>  }
>  
> @@ -750,8 +734,6 @@ static int __devexit jzfb_remove(struct platform_device *pdev)
>  	jz_gpio_bulk_free(jz_lcd_ctrl_pins, jzfb_num_ctrl_pins(jzfb));
>  	jz_gpio_bulk_free(jz_lcd_data_pins, jzfb_num_data_pins(jzfb));
>  
> -	release_mem_region(jzfb->mem->start, resource_size(jzfb->mem));
> -
>  	fb_dealloc_cmap(&jzfb->fb->cmap);
>  	jzfb_free_devmem(jzfb);
>  

--
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
diff mbox

Patch

diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
index 7669770..b0df279 100644
--- a/drivers/video/jz4740_fb.c
+++ b/drivers/video/jz4740_fb.c
@@ -632,23 +632,10 @@  static int __devinit jzfb_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!mem) {
-		dev_err(&pdev->dev, "Failed to get register memory resource\n");
-		return -ENXIO;
-	}
-
-	mem = request_mem_region(mem->start, resource_size(mem), pdev->name);
-	if (!mem) {
-		dev_err(&pdev->dev, "Failed to request register memory region\n");
-		return -EBUSY;
-	}
-
 	fb = framebuffer_alloc(sizeof(struct jzfb), &pdev->dev);
 	if (!fb) {
 		dev_err(&pdev->dev, "Failed to allocate framebuffer device\n");
-		ret = -ENOMEM;
-		goto err_release_mem_region;
+		return -ENOMEM;
 	}
 
 	fb->fbops = &jzfb_ops;
@@ -657,7 +644,6 @@  static int __devinit jzfb_probe(struct platform_device *pdev)
 	jzfb = fb->par;
 	jzfb->pdev = pdev;
 	jzfb->pdata = pdata;
-	jzfb->mem = mem;
 
 	jzfb->ldclk = devm_clk_get(&pdev->dev, "lcd");
 	if (IS_ERR(jzfb->ldclk)) {
@@ -673,9 +659,9 @@  static int __devinit jzfb_probe(struct platform_device *pdev)
 		goto err_framebuffer_release;
 	}
 
-	jzfb->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
+	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	jzfb->base = devm_request_and_ioremap(&pdev->dev, mem);
 	if (!jzfb->base) {
-		dev_err(&pdev->dev, "Failed to ioremap register memory region\n");
 		ret = -EBUSY;
 		goto err_framebuffer_release;
 	}
@@ -736,8 +722,6 @@  err_free_devmem:
 	jzfb_free_devmem(jzfb);
 err_framebuffer_release:
 	framebuffer_release(fb);
-err_release_mem_region:
-	release_mem_region(mem->start, resource_size(mem));
 	return ret;
 }
 
@@ -750,8 +734,6 @@  static int __devexit jzfb_remove(struct platform_device *pdev)
 	jz_gpio_bulk_free(jz_lcd_ctrl_pins, jzfb_num_ctrl_pins(jzfb));
 	jz_gpio_bulk_free(jz_lcd_data_pins, jzfb_num_data_pins(jzfb));
 
-	release_mem_region(jzfb->mem->start, resource_size(jzfb->mem));
-
 	fb_dealloc_cmap(&jzfb->fb->cmap);
 	jzfb_free_devmem(jzfb);