diff mbox

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

Message ID 1353642119-10253-2-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sachin Kamat Nov. 23, 2012, 3:41 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 |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

Comments

Inki Dae Nov. 23, 2012, 6:40 a.m. UTC | #1
> -----Original Message-----
> From: Sachin Kamat [mailto:sachin.kamat@linaro.org]
> Sent: Friday, November 23, 2012 12:42 PM
> To: dri-devel@lists.freedesktop.org
> Cc: inki.dae@samsung.com; jy0922.shim@samsung.com; airlied@linux.ie;
> sachin.kamat@linaro.org; patches@linaro.org
> Subject: [PATCH 1/5] 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 |    9 ++-------
>  1 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index ad04edd..57851cc 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -846,14 +846,14 @@ 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;
>  	}
> 
> -	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);
> @@ -918,11 +918,9 @@ static int __devinit fimd_probe(struct
> platform_device *pdev)
> 
>  err_clk:
>  	clk_disable(ctx->lcd_clk);
> -	clk_put(ctx->lcd_clk);

clk_disable shouldn't be called here so let's cleanup this also to reduce
unnecessary cleanup commits.

> 
>  err_bus_clk:
>  	clk_disable(ctx->bus_clk);
> -	clk_put(ctx->bus_clk);
> 

Ditto.

Thanks,
Inki Dae

>  err_clk_get:
>  	return ret;
> @@ -949,9 +947,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, 6:43 a.m. UTC | #2
On 23 November 2012 12:10, Inki Dae <inki.dae@samsung.com> wrote:
>
>
>> -----Original Message-----
>> From: Sachin Kamat [mailto:sachin.kamat@linaro.org]
>> Sent: Friday, November 23, 2012 12:42 PM
>> To: dri-devel@lists.freedesktop.org
>> Cc: inki.dae@samsung.com; jy0922.shim@samsung.com; airlied@linux.ie;
>> sachin.kamat@linaro.org; patches@linaro.org
>> Subject: [PATCH 1/5] 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 |    9 ++-------
>>  1 files changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index ad04edd..57851cc 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -846,14 +846,14 @@ 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;
>>       }
>>
>> -     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);
>> @@ -918,11 +918,9 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>>
>>  err_clk:
>>       clk_disable(ctx->lcd_clk);
>> -     clk_put(ctx->lcd_clk);
>
> clk_disable shouldn't be called here so let's cleanup this also to reduce
> unnecessary cleanup commits.
>
>>
>>  err_bus_clk:
>>       clk_disable(ctx->bus_clk);
>> -     clk_put(ctx->bus_clk);
>>
>
> Ditto.

OK. I will remove it. Do you want me to re-send only this patch or the
entire series?

>
> Thanks,
> Inki Dae
>
>>  err_clk_get:
>>       return ret;
>> @@ -949,9 +947,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..57851cc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -846,14 +846,14 @@  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;
 	}
 
-	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);
@@ -918,11 +918,9 @@  static int __devinit fimd_probe(struct platform_device *pdev)
 
 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;
@@ -949,9 +947,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;
 }