linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: omap: clk_round_rate() can return a zero upon error
@ 2013-12-10  2:18 Paul Walmsley
  2013-12-16  9:14 ` Viresh Kumar
  2013-12-16 14:58 ` Santosh Shilimkar
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Walmsley @ 2013-12-10  2:18 UTC (permalink / raw)
  To: Santosh Shilimkar, Viresh Kumar
  Cc: linux-omap, cpufreq, linux-pm, linux-kernel


Treat both negative and zero return values from clk_round_rate() as 
errors.  This is needed since subsequent patches will convert 
clk_round_rate()'s return value to be an unsigned type, rather than a 
signed type, since some clock sources can generate rates higher than 
(2^31)-1 Hz.

Eventually, when calling clk_round_rate(), only a return value of
zero will be considered a error.  All other values will be
considered valid rates.  The comparison against values less than
0 is kept to preserve the correct behavior in the meantime.

This patch also removes a bogus usage of IS_ERR_VALUE(), which is intended 
to be used only on combination pointer/error code return values; a 
side-benefit.

Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
---
Applies on v3.13-rc3.  See also:

http://marc.info/?l=linux-arm-kernel&m=138542591313620&w=2

  drivers/cpufreq/omap-cpufreq.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index a0acd0bfba40..0f41eb2609f3 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -63,7 +63,7 @@ static int omap_target(struct cpufreq_policy *policy, unsigned int index)

  	freq = new_freq * 1000;
  	ret = clk_round_rate(mpu_clk, freq);
-	if (IS_ERR_VALUE(ret)) {
+	if (ret <= 0) {
  		dev_warn(mpu_dev,
  			 "CPUfreq: Cannot find matching frequency for %lu\n",
  			 freq);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: omap: clk_round_rate() can return a zero upon error
  2013-12-10  2:18 [PATCH] cpufreq: omap: clk_round_rate() can return a zero upon error Paul Walmsley
@ 2013-12-16  9:14 ` Viresh Kumar
  2013-12-16 14:58 ` Santosh Shilimkar
  1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2013-12-16  9:14 UTC (permalink / raw)
  To: Paul Walmsley
  Cc: Santosh Shilimkar, linux-omap, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, Linux Kernel Mailing List

On 10 December 2013 07:48, Paul Walmsley <pwalmsley@nvidia.com> wrote:
> Treat both negative and zero return values from clk_round_rate() as errors.
> This is needed since subsequent patches will convert clk_round_rate()'s
> return value to be an unsigned type, rather than a signed type, since some
> clock sources can generate rates higher than (2^31)-1 Hz.
>
> Eventually, when calling clk_round_rate(), only a return value of
> zero will be considered a error.  All other values will be
> considered valid rates.  The comparison against values less than
> 0 is kept to preserve the correct behavior in the meantime.
>
> This patch also removes a bogus usage of IS_ERR_VALUE(), which is intended
> to be used only on combination pointer/error code return values; a
> side-benefit.
>
> Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpufreq: omap: clk_round_rate() can return a zero upon error
  2013-12-10  2:18 [PATCH] cpufreq: omap: clk_round_rate() can return a zero upon error Paul Walmsley
  2013-12-16  9:14 ` Viresh Kumar
@ 2013-12-16 14:58 ` Santosh Shilimkar
  1 sibling, 0 replies; 3+ messages in thread
From: Santosh Shilimkar @ 2013-12-16 14:58 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: Viresh Kumar, linux-omap, cpufreq, linux-pm, linux-kernel

On Monday 09 December 2013 09:18 PM, Paul Walmsley wrote:
> 
> Treat both negative and zero return values from clk_round_rate() as errors.  This is needed since subsequent patches will convert clk_round_rate()'s return value to be an unsigned type, rather than a signed type, since some clock sources can generate rates higher than (2^31)-1 Hz.
> 
> Eventually, when calling clk_round_rate(), only a return value of
> zero will be considered a error.  All other values will be
> considered valid rates.  The comparison against values less than
> 0 is kept to preserve the correct behavior in the meantime.
> 
> This patch also removes a bogus usage of IS_ERR_VALUE(), which is intended to be used only on combination pointer/error code return values; a side-benefit.
> 
> Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> ---
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-16 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10  2:18 [PATCH] cpufreq: omap: clk_round_rate() can return a zero upon error Paul Walmsley
2013-12-16  9:14 ` Viresh Kumar
2013-12-16 14:58 ` Santosh Shilimkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).