All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Joonyoung Shim <jy0922.shim@samsung.com>, rtc-linux@googlegroups.com
Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	a.zummo@towertech.it, alexandre.belloni@free-electrons.com,
	cw00.choi@samsung.com
Subject: [rtc-linux] Re: [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk
Date: Wed, 12 Aug 2015 09:10:06 +0900	[thread overview]
Message-ID: <55CA8EDE.8000006@samsung.com> (raw)
In-Reply-To: <1439292502-22912-3-git-send-email-jy0922.shim@samsung.com>

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;
>  }
> 

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Joonyoung Shim <jy0922.shim@samsung.com>, rtc-linux@googlegroups.com
Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	a.zummo@towertech.it, alexandre.belloni@free-electrons.com,
	cw00.choi@samsung.com
Subject: Re: [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk
Date: Wed, 12 Aug 2015 09:10:06 +0900	[thread overview]
Message-ID: <55CA8EDE.8000006@samsung.com> (raw)
In-Reply-To: <1439292502-22912-3-git-send-email-jy0922.shim@samsung.com>

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;
>  }
> 

  reply	other threads:[~2015-08-12  0:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 11:28 [rtc-linux] [PATCH 1/4] rtc: s3c: add missing clk control Joonyoung Shim
2015-08-11 11:28 ` Joonyoung Shim
2015-08-11 11:28 ` [rtc-linux] [PATCH 2/4] rtc: s3c: remove unnecessary NULL assignment Joonyoung Shim
2015-08-11 11:28   ` Joonyoung Shim
2015-08-12  0:07   ` [rtc-linux] " Krzysztof Kozlowski
2015-08-12  0:07     ` Krzysztof Kozlowski
2015-08-20 23:07   ` [rtc-linux] " Alexandre Belloni
2015-08-20 23:07     ` Alexandre Belloni
2015-08-11 11:28 ` [rtc-linux] [PATCH 3/4] rtc: s3c: use unified functions for enable/disable of clk Joonyoung Shim
2015-08-11 11:28   ` Joonyoung Shim
2015-08-12  0:10   ` Krzysztof Kozlowski [this message]
2015-08-12  0:10     ` Krzysztof Kozlowski
2015-08-12 10:26     ` [rtc-linux] " Joonyoung Shim
2015-08-12 10:26       ` Joonyoung Shim
2015-08-11 11:28 ` [rtc-linux] [PATCH 4/4] rtc: s3c: enable/disable clocks for alarm Joonyoung Shim
2015-08-11 11:28   ` Joonyoung Shim
2015-08-12  0:28   ` [rtc-linux] " Krzysztof Kozlowski
2015-08-12  0:28     ` Krzysztof Kozlowski
2015-08-12  1:09     ` [rtc-linux] " Joonyoung Shim
2015-08-12  1:09       ` Joonyoung Shim
2015-08-12  0:06 ` [rtc-linux] Re: [PATCH 1/4] rtc: s3c: add missing clk control Krzysztof Kozlowski
2015-08-12  0:06   ` Krzysztof Kozlowski
2015-08-20 23:06 ` [rtc-linux] " Alexandre Belloni
2015-08-20 23:06   ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55CA8EDE.8000006@samsung.com \
    --to=k.kozlowski@samsung.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=cw00.choi@samsung.com \
    --cc=jy0922.shim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.