Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1205069 > unrolled thread

[PATCH 1/4] rtc: s3c: add missing clk control

Started byJoonyoung Shim <jy0922.shim@samsung.com>
First post2015-08-11 13:30 +0200
Last post2015-08-12 02:10 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/4] rtc: s3c: add missing clk control Joonyoung Shim <jy0922.shim@samsung.com> - 2015-08-11 13:30 +0200
    [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk Joonyoung Shim <jy0922.shim@samsung.com> - 2015-08-11 13:30 +0200
      Re: [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of  clk Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-12 02:20 +0200
        Re: [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of  clk Joonyoung Shim <jy0922.shim@samsung.com> - 2015-08-12 12:30 +0200
    Re: [PATCH 1/4] rtc: s3c: add missing clk control Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-12 02:10 +0200

#1205069 — [PATCH 1/4] rtc: s3c: add missing clk control

FromJoonyoung Shim <jy0922.shim@samsung.com>
Date2015-08-11 13:30 +0200
Subject[PATCH 1/4] rtc: s3c: add missing clk control
Message-ID<pWfUJ-3Em-3@gated-at.bofh.it>
It's missed to call clk_unprepare() about info->rtc_src_clk in
s3c_rtc_remove and to call clk_disable_unprepare about info->rtc_clk in
error routine of s3c_rtc_probe.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
 drivers/rtc/rtc-s3c.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index a0f8323..d1866a4 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -410,6 +410,8 @@ static int s3c_rtc_remove(struct platform_device *pdev)
 
 	s3c_rtc_setaie(info->dev, 0);
 
+	if (info->data->needs_src_clk)
+		clk_unprepare(info->rtc_src_clk);
 	clk_unprepare(info->rtc_clk);
 	info->rtc_clk = NULL;
 
@@ -482,6 +484,7 @@ static int s3c_rtc_probe(struct platform_device *pdev)
 		if (IS_ERR(info->rtc_src_clk)) {
 			dev_err(&pdev->dev,
 				"failed to find rtc source clock\n");
+			clk_disable_unprepare(info->rtc_clk);
 			return PTR_ERR(info->rtc_src_clk);
 		}
 		clk_prepare_enable(info->rtc_src_clk);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1205073 — [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk

FromJoonyoung Shim <jy0922.shim@samsung.com>
Date2015-08-11 13:30 +0200
Subject[PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk
Message-ID<pWfUK-3Em-27@gated-at.bofh.it>
In reply to#1205069
The driver uses clk_prepare_enable()/clk_disable_unprepare() only in
probe only, elsewhere, use the unified functions for enable/disable of
clk, e.g. s3c_rtc_enable_clk() / s3c_rtc_disable_clk(), so it's better
to use them for consistency of code.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
 drivers/rtc/rtc-s3c.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 44b2921..abe2a6d 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -476,19 +476,21 @@ static int s3c_rtc_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to find rtc clock\n");
 		return PTR_ERR(info->rtc_clk);
 	}
-	clk_prepare_enable(info->rtc_clk);
+	clk_prepare(info->rtc_clk);
 
 	if (info->data->needs_src_clk) {
 		info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src");
 		if (IS_ERR(info->rtc_src_clk)) {
 			dev_err(&pdev->dev,
 				"failed to find rtc source clock\n");
-			clk_disable_unprepare(info->rtc_clk);
+			clk_unprepare(info->rtc_clk);
 			return PTR_ERR(info->rtc_src_clk);
 		}
-		clk_prepare_enable(info->rtc_src_clk);
+		clk_prepare(info->rtc_src_clk);
 	}
 
+	s3c_rtc_enable_clk(info);
+
 	/* check to see if everything is setup correctly */
 	if (info->data->enable)
 		info->data->enable(info);
@@ -548,9 +550,11 @@ static int s3c_rtc_probe(struct platform_device *pdev)
 	if (info->data->disable)
 		info->data->disable(info);
 
+	s3c_rtc_disable_clk(info);
+
 	if (info->data->needs_src_clk)
-		clk_disable_unprepare(info->rtc_src_clk);
-	clk_disable_unprepare(info->rtc_clk);
+		clk_unprepare(info->rtc_src_clk);
+	clk_unprepare(info->rtc_clk);
 
 	return ret;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205515 — Re: [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2015-08-12 02:20 +0200
SubjectRe: [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk
Message-ID<pWrVU-4h9-1@gated-at.bofh.it>
In reply to#1205073
On 11.08.2015 20:28, Joonyoung Shim wrote:
> The driver uses clk_prepare_enable()/clk_disable_unprepare() only in
> probe only, elsewhere, use the unified functions for enable/disable of
> clk, e.g. s3c_rtc_enable_clk() / s3c_rtc_disable_clk(), so it's better
> to use them for consistency of code.
> 
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
> ---
>  drivers/rtc/rtc-s3c.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)

First of all - the code is larger (9 insertions, 5 deletion) so I have
doubts if this is better.

Second - this is not equivalent change. The s3c_rtc_enable_clk/disable
calls grab spin lock which is not necessary in probe.

Best regards,
Krzysztof

> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 44b2921..abe2a6d 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -476,19 +476,21 @@ static int s3c_rtc_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "failed to find rtc clock\n");
>  		return PTR_ERR(info->rtc_clk);
>  	}
> -	clk_prepare_enable(info->rtc_clk);
> +	clk_prepare(info->rtc_clk);
>  
>  	if (info->data->needs_src_clk) {
>  		info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src");
>  		if (IS_ERR(info->rtc_src_clk)) {
>  			dev_err(&pdev->dev,
>  				"failed to find rtc source clock\n");
> -			clk_disable_unprepare(info->rtc_clk);
> +			clk_unprepare(info->rtc_clk);
>  			return PTR_ERR(info->rtc_src_clk);
>  		}
> -		clk_prepare_enable(info->rtc_src_clk);
> +		clk_prepare(info->rtc_src_clk);
>  	}
>  
> +	s3c_rtc_enable_clk(info);
> +
>  	/* check to see if everything is setup correctly */
>  	if (info->data->enable)
>  		info->data->enable(info);
> @@ -548,9 +550,11 @@ static int s3c_rtc_probe(struct platform_device *pdev)
>  	if (info->data->disable)
>  		info->data->disable(info);
>  
> +	s3c_rtc_disable_clk(info);
> +
>  	if (info->data->needs_src_clk)
> -		clk_disable_unprepare(info->rtc_src_clk);
> -	clk_disable_unprepare(info->rtc_clk);
> +		clk_unprepare(info->rtc_src_clk);
> +	clk_unprepare(info->rtc_clk);
>  
>  	return ret;
>  }
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205909 — Re: [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk

FromJoonyoung Shim <jy0922.shim@samsung.com>
Date2015-08-12 12:30 +0200
SubjectRe: [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk
Message-ID<pWBse-1Ag-23@gated-at.bofh.it>
In reply to#1205515
On 08/12/2015 09:10 AM, Krzysztof Kozlowski wrote:
> On 11.08.2015 20:28, Joonyoung Shim wrote:
>> The driver uses clk_prepare_enable()/clk_disable_unprepare() only in
>> probe only, elsewhere, use the unified functions for enable/disable of
>> clk, e.g. s3c_rtc_enable_clk() / s3c_rtc_disable_clk(), so it's better
>> to use them for consistency of code.
>>
>> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
>> ---
>>  drivers/rtc/rtc-s3c.c | 14 +++++++++-----
>>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> First of all - the code is larger (9 insertions, 5 deletion) so I have
> doubts if this is better.
> 
> Second - this is not equivalent change. The s3c_rtc_enable_clk/disable
> calls grab spin lock which is not necessary in probe.
> 

I made this patch because of patch 4/4, but patch 4/4 should be removed
dependency from previous patches, so i will drop this patch.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205513

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2015-08-12 02:10 +0200
Message-ID<pWrMe-45O-11@gated-at.bofh.it>
In reply to#1205069
On 11.08.2015 20:28, Joonyoung Shim wrote:
> It's missed to call clk_unprepare() about info->rtc_src_clk in
> s3c_rtc_remove and to call clk_disable_unprepare about info->rtc_clk in
> error routine of s3c_rtc_probe.
> 
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
> ---
>  drivers/rtc/rtc-s3c.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web