diff mbox

cpufreq: Avoid calling cpufreq driver's target() routine if target_freq == policy->cur

Message ID 1d7b6e421a335255da956804b43ce3517538409c.1351244153.git.viresh.kumar@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Viresh Kumar Oct. 26, 2012, 9:36 a.m. UTC
Avoid calling cpufreq driver's target() routine if new frequency is same as
policies current frequency.

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

Comments

Rafael Wysocki Oct. 26, 2012, 11:17 a.m. UTC | #1
On Friday, October 26, 2012 03:06:26 PM Viresh Kumar wrote:
> Avoid calling cpufreq driver's target() routine if new frequency is same as
> policies current frequency.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Looks reasonable.

Any objection from anyone?

Rafael


> ---
>  drivers/cpufreq/cpufreq.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 261ef65..28dc134 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1476,6 +1476,10 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
>  
>  	pr_debug("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
>  		target_freq, relation);
> +
> +	if (target_freq == policy->cur)
> +		return 0;
> +
>  	if (cpu_online(policy->cpu) && cpufreq_driver->target)
>  		retval = cpufreq_driver->target(policy, target_freq, relation);
>  
>
Rafael Wysocki Oct. 31, 2012, 12:44 a.m. UTC | #2
On Friday, October 26, 2012 01:17:12 PM Rafael J. Wysocki wrote:
> On Friday, October 26, 2012 03:06:26 PM Viresh Kumar wrote:
> > Avoid calling cpufreq driver's target() routine if new frequency is same as
> > policies current frequency.
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> 
> Looks reasonable.
> 
> Any objection from anyone?

OK, no objections.

Applied to the linux-next branch of linux-pm.git as v3.8 material.

Thanks,
Rafael


> > ---
> >  drivers/cpufreq/cpufreq.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 261ef65..28dc134 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -1476,6 +1476,10 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
> >  
> >  	pr_debug("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
> >  		target_freq, relation);
> > +
> > +	if (target_freq == policy->cur)
> > +		return 0;
> > +
> >  	if (cpu_online(policy->cpu) && cpufreq_driver->target)
> >  		retval = cpufreq_driver->target(policy, target_freq, relation);
> >  
> > 
>
diff mbox

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 261ef65..28dc134 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1476,6 +1476,10 @@  int __cpufreq_driver_target(struct cpufreq_policy *policy,
 
 	pr_debug("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
 		target_freq, relation);
+
+	if (target_freq == policy->cur)
+		return 0;
+
 	if (cpu_online(policy->cpu) && cpufreq_driver->target)
 		retval = cpufreq_driver->target(policy, target_freq, relation);