diff mbox

[07/18] cpufreq: Drop (now) useless check 'cpu > nr_cpu_ids'

Message ID 0b79fabc34316fe1e38c9cbe4750bd68ae65b03b.1422346933.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar Jan. 27, 2015, 8:36 a.m. UTC
Earlier we used to find the 'policy' belonging to a cpu with the help of a
per-cpu variable. And if 'cpu' passed to cpufreq_cpu_get() is bigger than
'nr_cpu_ids', it would have caused unpredictable issues as the per-cpu variable
wouldn't have covered that value of 'cpu'. And so we had this check.

We traverse active-policy list to find policy for a cpu now. Even if 'cpu'
passed to cpufreq_cpu_get() is an invalid number (i.e. greater than nr_cpu_ids),
we will be able to manage it without any unpredictable behavior.

And so this check isn't required anymore. Get rid of it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cpufreq.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Viresh Kumar Feb. 12, 2015, 7:50 a.m. UTC | #1
On 12 February 2015 at 11:15, Saravana Kannan <skannan@codeaurora.org> wrote:
> You are getting rid of this check because you no longer use the per-cpu
> variable. So, just squash it with the previous patch that removes the
> per-cpu variable?

We can, but its always better to keep such things in separate patches so that
we know exactly why we did it.. And this is how Me and Srivatsa were asking
you to do it earlier. It helps later on why something has changed.
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 7f947287ba46..d9528046f651 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -172,9 +172,6 @@  struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
 	struct cpufreq_policy *policy = NULL;
 	unsigned long flags;
 
-	if (cpu >= nr_cpu_ids)
-		return NULL;
-
 	if (!down_read_trylock(&cpufreq_rwsem))
 		return NULL;