All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <pwalmsley@nvidia.com>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: <linux-omap@vger.kernel.org>, <cpufreq@vger.kernel.org>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] cpufreq: omap: clk_round_rate() can return a zero upon error
Date: Mon, 9 Dec 2013 18:18:22 -0800	[thread overview]
Message-ID: <alpine.DEB.2.02.1312091812440.4127@tamien> (raw)


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

WARNING: multiple messages have this Message-ID (diff)
From: Paul Walmsley <pwalmsley@nvidia.com>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-omap@vger.kernel.org, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] cpufreq: omap: clk_round_rate() can return a zero upon error
Date: Mon, 9 Dec 2013 18:18:22 -0800	[thread overview]
Message-ID: <alpine.DEB.2.02.1312091812440.4127@tamien> (raw)


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

             reply	other threads:[~2013-12-10  2:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10  2:18 Paul Walmsley [this message]
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
2013-12-16 14:58   ` Santosh Shilimkar

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=alpine.DEB.2.02.1312091812440.4127@tamien \
    --to=pwalmsley@nvidia.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=santosh.shilimkar@ti.com \
    --cc=viresh.kumar@linaro.org \
    /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.