diff mbox

[2/3] ASoC: omap-mcbsp: Convert to use devm_ioremap_resource

Message ID 1440406145.27868.2.camel@ingics.com (mailing list archive)
State Accepted
Commit 5aec892a6ebe5a3e2a006d969b5fab59e6c79f63
Headers show

Commit Message

Axel Lin Aug. 24, 2015, 8:49 a.m. UTC
Use devm_ioremap_resource() instead of open code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/omap/mcbsp.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

Comments

Peter Ujfalusi Aug. 24, 2015, 10:28 a.m. UTC | #1
On 08/24/2015 11:49 AM, Axel Lin wrote:
> Use devm_ioremap_resource() instead of open code.

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  sound/soc/omap/mcbsp.c | 20 +++++---------------
>  1 file changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 68a1252..c7563e2 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -965,25 +965,15 @@ int omap_mcbsp_init(struct platform_device *pdev)
>  	mcbsp->free = true;
>  
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
> -	if (!res) {
> +	if (!res)
>  		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -		if (!res) {
> -			dev_err(mcbsp->dev, "invalid memory resource\n");
> -			return -ENOMEM;
> -		}
> -	}
> -	if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
> -				     dev_name(&pdev->dev))) {
> -		dev_err(mcbsp->dev, "memory region already claimed\n");
> -		return -ENODEV;
> -	}
> +
> +	mcbsp->io_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(mcbsp->io_base))
> +		return PTR_ERR(mcbsp->io_base);
>  
>  	mcbsp->phys_base = res->start;
>  	mcbsp->reg_cache_size = resource_size(res);
> -	mcbsp->io_base = devm_ioremap(&pdev->dev, res->start,
> -				      resource_size(res));
> -	if (!mcbsp->io_base)
> -		return -ENOMEM;
>  
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
>  	if (!res)
>
diff mbox

Patch

diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 68a1252..c7563e2 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -965,25 +965,15 @@  int omap_mcbsp_init(struct platform_device *pdev)
 	mcbsp->free = true;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
-	if (!res) {
+	if (!res)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		if (!res) {
-			dev_err(mcbsp->dev, "invalid memory resource\n");
-			return -ENOMEM;
-		}
-	}
-	if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
-				     dev_name(&pdev->dev))) {
-		dev_err(mcbsp->dev, "memory region already claimed\n");
-		return -ENODEV;
-	}
+
+	mcbsp->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(mcbsp->io_base))
+		return PTR_ERR(mcbsp->io_base);
 
 	mcbsp->phys_base = res->start;
 	mcbsp->reg_cache_size = resource_size(res);
-	mcbsp->io_base = devm_ioremap(&pdev->dev, res->start,
-				      resource_size(res));
-	if (!mcbsp->io_base)
-		return -ENOMEM;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
 	if (!res)