diff mbox

[Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

Message ID 1353660208-9776-3-git-send-email-sachin.kamat@linaro.org
State Superseded
Headers show

Commit Message

Sachin Kamat Nov. 23, 2012, 8:43 a.m. UTC
devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31 ++++++-----------------------
 1 files changed, 7 insertions(+), 24 deletions(-)

Comments

대인기/Tizen Platform Lab(SR)/삼성전자 Nov. 23, 2012, 9:51 a.m. UTC | #1
The subject mentions just only 'use devm_clk_get in exynos_dev_fimd.c' but
this patch removes unnecessary clk_disable calls also. Just separate this
patch into two as you mentioned. For this, already applied old one. So could
you send another one? Sorry for inconvenient. :)

Thanks,
Inki Dae

> -----Original Message-----
> From: Sachin Kamat [mailto:sachin.kamat@linaro.org]
> Sent: Friday, November 23, 2012 5:43 PM
> To: dri-devel@lists.freedesktop.org
> Cc: inki.dae@samsung.com; sachin.kamat@linaro.org; patches@linaro.org
> Subject: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
> 
> devm_clk_get is device managed and makes error handling and exit code
> simpler.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31
++++++--------------------
> ---
>  1 files changed, 7 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index ad04edd..00bd266 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -846,18 +846,16 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>  	if (!ctx)
>  		return -ENOMEM;
> 
> -	ctx->bus_clk = clk_get(dev, "fimd");
> +	ctx->bus_clk = devm_clk_get(dev, "fimd");
>  	if (IS_ERR(ctx->bus_clk)) {
>  		dev_err(dev, "failed to get bus clock\n");
> -		ret = PTR_ERR(ctx->bus_clk);
> -		goto err_clk_get;
> +		return PTR_ERR(ctx->bus_clk);
>  	}
> 
> -	ctx->lcd_clk = clk_get(dev, "sclk_fimd");
> +	ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>  	if (IS_ERR(ctx->lcd_clk)) {
>  		dev_err(dev, "failed to get lcd clock\n");
> -		ret = PTR_ERR(ctx->lcd_clk);
> -		goto err_bus_clk;
> +		return PTR_ERR(ctx->lcd_clk);
>  	}
> 
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>  	ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
>  	if (!ctx->regs) {
>  		dev_err(dev, "failed to map registers\n");
> -		ret = -ENXIO;
> -		goto err_clk;
> +		return -ENXIO;
>  	}
> 
>  	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>  	if (!res) {
>  		dev_err(dev, "irq request failed.\n");
> -		goto err_clk;
> +		return -ENXIO;
>  	}
> 
>  	ctx->irq = res->start;
> @@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device
> *pdev)
>  							0, "drm_fimd", ctx);
>  	if (ret) {
>  		dev_err(dev, "irq request failed.\n");
> -		goto err_clk;
> +		return ret;
>  	}
> 
>  	ctx->vidcon0 = pdata->vidcon0;
> @@ -915,17 +912,6 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
>  	exynos_drm_subdrv_register(subdrv);
> 
>  	return 0;
> -
> -err_clk:
> -	clk_disable(ctx->lcd_clk);
> -	clk_put(ctx->lcd_clk);
> -
> -err_bus_clk:
> -	clk_disable(ctx->bus_clk);
> -	clk_put(ctx->bus_clk);
> -
> -err_clk_get:
> -	return ret;
>  }
> 
>  static int __devexit fimd_remove(struct platform_device *pdev)
> @@ -949,9 +935,6 @@ static int __devexit fimd_remove(struct
> platform_device *pdev)
>  out:
>  	pm_runtime_disable(dev);
> 
> -	clk_put(ctx->lcd_clk);
> -	clk_put(ctx->bus_clk);
> -
>  	return 0;
>  }
> 
> --
> 1.7.4.1
Sachin Kamat Nov. 23, 2012, 9:53 a.m. UTC | #2
On 23 November 2012 15:21, Inki Dae <inki.dae@samsung.com> wrote:
> The subject mentions just only 'use devm_clk_get in exynos_dev_fimd.c' but
> this patch removes unnecessary clk_disable calls also. Just separate this
> patch into two as you mentioned. For this, already applied old one. So could
> you send another one? Sorry for inconvenient. :)

He he.. no problem.. i will send another patch which just contains
removing clk_disable.

>
> Thanks,
> Inki Dae
>
>> -----Original Message-----
>> From: Sachin Kamat [mailto:sachin.kamat@linaro.org]
>> Sent: Friday, November 23, 2012 5:43 PM
>> To: dri-devel@lists.freedesktop.org
>> Cc: inki.dae@samsung.com; sachin.kamat@linaro.org; patches@linaro.org
>> Subject: [PATCH Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
>>
>> devm_clk_get is device managed and makes error handling and exit code
>> simpler.
>>
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   31
> ++++++--------------------
>> ---
>>  1 files changed, 7 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index ad04edd..00bd266 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -846,18 +846,16 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>       if (!ctx)
>>               return -ENOMEM;
>>
>> -     ctx->bus_clk = clk_get(dev, "fimd");
>> +     ctx->bus_clk = devm_clk_get(dev, "fimd");
>>       if (IS_ERR(ctx->bus_clk)) {
>>               dev_err(dev, "failed to get bus clock\n");
>> -             ret = PTR_ERR(ctx->bus_clk);
>> -             goto err_clk_get;
>> +             return PTR_ERR(ctx->bus_clk);
>>       }
>>
>> -     ctx->lcd_clk = clk_get(dev, "sclk_fimd");
>> +     ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
>>       if (IS_ERR(ctx->lcd_clk)) {
>>               dev_err(dev, "failed to get lcd clock\n");
>> -             ret = PTR_ERR(ctx->lcd_clk);
>> -             goto err_bus_clk;
>> +             return PTR_ERR(ctx->lcd_clk);
>>       }
>>
>>       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> @@ -865,14 +863,13 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>       ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
>>       if (!ctx->regs) {
>>               dev_err(dev, "failed to map registers\n");
>> -             ret = -ENXIO;
>> -             goto err_clk;
>> +             return -ENXIO;
>>       }
>>
>>       res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>>       if (!res) {
>>               dev_err(dev, "irq request failed.\n");
>> -             goto err_clk;
>> +             return -ENXIO;
>>       }
>>
>>       ctx->irq = res->start;
>> @@ -881,7 +878,7 @@ static int __devinit fimd_probe(struct platform_device
>> *pdev)
>>                                                       0, "drm_fimd", ctx);
>>       if (ret) {
>>               dev_err(dev, "irq request failed.\n");
>> -             goto err_clk;
>> +             return ret;
>>       }
>>
>>       ctx->vidcon0 = pdata->vidcon0;
>> @@ -915,17 +912,6 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>       exynos_drm_subdrv_register(subdrv);
>>
>>       return 0;
>> -
>> -err_clk:
>> -     clk_disable(ctx->lcd_clk);
>> -     clk_put(ctx->lcd_clk);
>> -
>> -err_bus_clk:
>> -     clk_disable(ctx->bus_clk);
>> -     clk_put(ctx->bus_clk);
>> -
>> -err_clk_get:
>> -     return ret;
>>  }
>>
>>  static int __devexit fimd_remove(struct platform_device *pdev)
>> @@ -949,9 +935,6 @@ static int __devexit fimd_remove(struct
>> platform_device *pdev)
>>  out:
>>       pm_runtime_disable(dev);
>>
>> -     clk_put(ctx->lcd_clk);
>> -     clk_put(ctx->bus_clk);
>> -
>>       return 0;
>>  }
>>
>> --
>> 1.7.4.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index ad04edd..00bd266 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -846,18 +846,16 @@  static int __devinit fimd_probe(struct platform_device *pdev)
 	if (!ctx)
 		return -ENOMEM;
 
-	ctx->bus_clk = clk_get(dev, "fimd");
+	ctx->bus_clk = devm_clk_get(dev, "fimd");
 	if (IS_ERR(ctx->bus_clk)) {
 		dev_err(dev, "failed to get bus clock\n");
-		ret = PTR_ERR(ctx->bus_clk);
-		goto err_clk_get;
+		return PTR_ERR(ctx->bus_clk);
 	}
 
-	ctx->lcd_clk = clk_get(dev, "sclk_fimd");
+	ctx->lcd_clk = devm_clk_get(dev, "sclk_fimd");
 	if (IS_ERR(ctx->lcd_clk)) {
 		dev_err(dev, "failed to get lcd clock\n");
-		ret = PTR_ERR(ctx->lcd_clk);
-		goto err_bus_clk;
+		return PTR_ERR(ctx->lcd_clk);
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -865,14 +863,13 @@  static int __devinit fimd_probe(struct platform_device *pdev)
 	ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
 	if (!ctx->regs) {
 		dev_err(dev, "failed to map registers\n");
-		ret = -ENXIO;
-		goto err_clk;
+		return -ENXIO;
 	}
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!res) {
 		dev_err(dev, "irq request failed.\n");
-		goto err_clk;
+		return -ENXIO;
 	}
 
 	ctx->irq = res->start;
@@ -881,7 +878,7 @@  static int __devinit fimd_probe(struct platform_device *pdev)
 							0, "drm_fimd", ctx);
 	if (ret) {
 		dev_err(dev, "irq request failed.\n");
-		goto err_clk;
+		return ret;
 	}
 
 	ctx->vidcon0 = pdata->vidcon0;
@@ -915,17 +912,6 @@  static int __devinit fimd_probe(struct platform_device *pdev)
 	exynos_drm_subdrv_register(subdrv);
 
 	return 0;
-
-err_clk:
-	clk_disable(ctx->lcd_clk);
-	clk_put(ctx->lcd_clk);
-
-err_bus_clk:
-	clk_disable(ctx->bus_clk);
-	clk_put(ctx->bus_clk);
-
-err_clk_get:
-	return ret;
 }
 
 static int __devexit fimd_remove(struct platform_device *pdev)
@@ -949,9 +935,6 @@  static int __devexit fimd_remove(struct platform_device *pdev)
 out:
 	pm_runtime_disable(dev);
 
-	clk_put(ctx->lcd_clk);
-	clk_put(ctx->bus_clk);
-
 	return 0;
 }