diff mbox

[16/17] cpufreq: remove check for cpufreq_disabled() from cpufreq_cpu_{get|put}()

Message ID 49250a2946ff12500a5474eb9384c125b3ede23c.1420181916.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar Jan. 2, 2015, 7:04 a.m. UTC
In most of the cases cpufreq wouldn't be disabled and this adds unnecessary
delay for its users. In the case if cpufreq is really disabled, then the per-cpu
variable will also return NULL and things will continue working as is. Remove
this unnecessary check.

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

Comments

Viresh Kumar Jan. 25, 2015, 1:24 p.m. UTC | #1
On 2 January 2015 at 12:34, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> In most of the cases cpufreq wouldn't be disabled and this adds unnecessary
> delay for its users. In the case if cpufreq is really disabled, then the per-cpu
> variable will also return NULL and things will continue working as is. Remove
> this unnecessary check.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/cpufreq/cpufreq.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 14d637a28dd8..62c6a0b8b0d1 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -202,9 +202,6 @@ struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
>         struct cpufreq_policy *policy = NULL;
>         unsigned long flags;
>
> -       if (cpufreq_disabled())
> -               return NULL;
> -
>         if (!down_read_trylock(&cpufreq_rwsem))
>                 return NULL;
>
> @@ -229,9 +226,6 @@ EXPORT_SYMBOL_GPL(cpufreq_cpu_get);
>
>  void cpufreq_cpu_put(struct cpufreq_policy *policy)
>  {
> -       if (cpufreq_disabled())
> -               return;
> -
>         kobject_put(&policy->kobj);
>         up_read(&cpufreq_rwsem);
>  }

@Rafael: Are you fine with this patch as is? I meant, you just left it for
rebase conflict or because you want it to be part of the WARN() you
suggested?

The WARN here might not be a good idea as this can be called by
users while cpufreq is disabled. But we don't need this check because
of the reasons I mentioned in commit log.
--
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
Viresh Kumar Jan. 27, 2015, 3:47 a.m. UTC | #2
On 26 January 2015 at 06:09, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> It depended on [15/17] that I didn't apply.

That's all I wanted to know.

>> The WARN here might not be a good idea as this can be called by
>> users while cpufreq is disabled. But we don't need this check because
>> of the reasons I mentioned in commit log.
>
> I'm not sure which commit log are you talking about, this one or the [15/17] one?

This one.
--
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 14d637a28dd8..62c6a0b8b0d1 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -202,9 +202,6 @@  struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
 	struct cpufreq_policy *policy = NULL;
 	unsigned long flags;
 
-	if (cpufreq_disabled())
-		return NULL;
-
 	if (!down_read_trylock(&cpufreq_rwsem))
 		return NULL;
 
@@ -229,9 +226,6 @@  EXPORT_SYMBOL_GPL(cpufreq_cpu_get);
 
 void cpufreq_cpu_put(struct cpufreq_policy *policy)
 {
-	if (cpufreq_disabled())
-		return;
-
 	kobject_put(&policy->kobj);
 	up_read(&cpufreq_rwsem);
 }