diff mbox

[02/24] drm/rcar-du: Use devm_ioremap_resource()

Message ID 1372326574-4315-3-git-send-email-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart June 27, 2013, 9:49 a.m. UTC
Replace the devm_request_mem_region() and devm_ioremap_nocache() calls
with devm_ioremap_resource().

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

Comments

Sergei Shtylyov June 27, 2013, 1:04 p.m. UTC | #1
Hello.

On 27-06-2013 13:49, Laurent Pinchart wrote:

> Replace the devm_request_mem_region() and devm_ioremap_nocache() calls
> with devm_ioremap_resource().

> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>   drivers/gpu/drm/rcar-du/rcar_du_drv.c | 20 ++------------------
>   1 file changed, 2 insertions(+), 18 deletions(-)

> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 003b34e..24ab0ca 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
[...]
> @@ -129,24 +128,9 @@ static int rcar_du_load(struct drm_device *dev, unsigned long flags)
>
>   	/* I/O resources and clocks */
>   	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
[...]
> +	rcdu->mmio = devm_ioremap_resource(&pdev->dev, mem);
> +	if (IS_ERR(rcdu->mmio))
>   		return -ENOMEM;

    You should return PTR_ERR(rcdu->mmio).

WBR, Sergei
Laurent Pinchart July 1, 2013, 2:30 p.m. UTC | #2
Hi Sergei,

On Thursday 27 June 2013 17:04:45 Sergei Shtylyov wrote:
> On 27-06-2013 13:49, Laurent Pinchart wrote:
> > Replace the devm_request_mem_region() and devm_ioremap_nocache() calls
> > with devm_ioremap_resource().
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >   drivers/gpu/drm/rcar-du/rcar_du_drv.c | 20 ++------------------
> >   1 file changed, 2 insertions(+), 18 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 003b34e..24ab0ca 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> 
> [...]
> 
> > @@ -129,24 +128,9 @@ static int rcar_du_load(struct drm_device *dev,
> > unsigned long flags)> 
> >   	/* I/O resources and clocks */
> >   	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> 
> [...]
> 
> > +	rcdu->mmio = devm_ioremap_resource(&pdev->dev, mem);
> > +	if (IS_ERR(rcdu->mmio))
> > 
> >   		return -ENOMEM;
> 
>     You should return PTR_ERR(rcdu->mmio).

Good point, I'll fix that. Thank you.
diff mbox

Patch

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 003b34e..24ab0ca 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -107,7 +107,6 @@  static int rcar_du_load(struct drm_device *dev, unsigned long flags)
 	struct platform_device *pdev = dev->platformdev;
 	struct rcar_du_platform_data *pdata = pdev->dev.platform_data;
 	struct rcar_du_device *rcdu;
-	struct resource *ioarea;
 	struct resource *mem;
 	int ret;
 
@@ -129,24 +128,9 @@  static int rcar_du_load(struct drm_device *dev, unsigned long flags)
 
 	/* I/O resources and clocks */
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (mem == NULL) {
-		dev_err(&pdev->dev, "failed to get memory resource\n");
-		return -EINVAL;
-	}
-
-	ioarea = devm_request_mem_region(&pdev->dev, mem->start,
-					 resource_size(mem), pdev->name);
-	if (ioarea == NULL) {
-		dev_err(&pdev->dev, "failed to request memory region\n");
-		return -EBUSY;
-	}
-
-	rcdu->mmio = devm_ioremap_nocache(&pdev->dev, ioarea->start,
-					  resource_size(ioarea));
-	if (rcdu->mmio == NULL) {
-		dev_err(&pdev->dev, "failed to remap memory resource\n");
+	rcdu->mmio = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(rcdu->mmio))
 		return -ENOMEM;
-	}
 
 	rcdu->clock = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(rcdu->clock)) {