Message ID | 32e5bed743cc6cc4e614291a7080299f5f0d0933.1350677395.git.viresh.kumar@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Saturday 20 of October 2012 01:42:05 Viresh Kumar wrote: > There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for drivers that > don't support getavg() routine. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> The patch doesn't seem to follow the changelog or the other way around. Thanks, Rafael > --- > drivers/cpufreq/cpufreq.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 85df538..f552d5f 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -1511,12 +1511,14 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) > { > int ret = 0; > > + if (!(cpu_online(cpu) && cpufreq_driver->getavg)) > + return 0; > + > policy = cpufreq_cpu_get(policy->cpu); > if (!policy) > return -EINVAL; > > - if (cpu_online(cpu) && cpufreq_driver->getavg) > - ret = cpufreq_driver->getavg(policy, cpu); > + ret = cpufreq_driver->getavg(policy, cpu); > > cpufreq_cpu_put(policy); > return ret; >
On Oct 20, 2012 3:37 AM, "Rafael J. Wysocki" <rjw@sisk.pl> wrote: > > On Saturday 20 of October 2012 01:42:05 Viresh Kumar wrote: > > There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for drivers that > > don't support getavg() routine. > > > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > > The patch doesn't seem to follow the changelog or the other way around. Sorry if my log isn't clear enough. But i could still see it matching the code :) I have moved the check for drivers capabilities at the top of routine, so that there is no need to call mentioned routines. > > Thanks, > Rafael > > > > --- > > drivers/cpufreq/cpufreq.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > index 85df538..f552d5f 100644 > > --- a/drivers/cpufreq/cpufreq.c > > +++ b/drivers/cpufreq/cpufreq.c > > @@ -1511,12 +1511,14 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) > > { > > int ret = 0; > > > > + if (!(cpu_online(cpu) && cpufreq_driver->getavg)) > > + return 0; > > + > > policy = cpufreq_cpu_get(policy->cpu); > > if (!policy) > > return -EINVAL; > > > > - if (cpu_online(cpu) && cpufreq_driver->getavg) > > - ret = cpufreq_driver->getavg(policy, cpu); > > + ret = cpufreq_driver->getavg(policy, cpu); > > > > cpufreq_cpu_put(policy); > > return ret; > > > -- > I speak only for myself. > Rafael J. Wysocki, Intel Open Source Technology Center.
Re-sending, as it bounced from the lists :( When i reply to mail from my Samsung S2, it replies in HTML format. Don't know how to fix it :) On 20 October 2012 10:12, Viresh Kumar <viresh.kumar@linaro.org> wrote: > > On Oct 20, 2012 3:37 AM, "Rafael J. Wysocki" <rjw@sisk.pl> wrote: >> >> On Saturday 20 of October 2012 01:42:05 Viresh Kumar wrote: >> > There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for >> > drivers that >> > don't support getavg() routine. >> > >> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >> >> The patch doesn't seem to follow the changelog or the other way around. > > Sorry if my log isn't clear enough. > But i could still see it matching the code :) > > I have moved the check for drivers capabilities at the top > of routine, so that there is no need to call mentioned routines. > >> >> Thanks, >> Rafael >> >> >> > --- >> > drivers/cpufreq/cpufreq.c | 6 ++++-- >> > 1 file changed, 4 insertions(+), 2 deletions(-) >> > >> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c >> > index 85df538..f552d5f 100644 >> > --- a/drivers/cpufreq/cpufreq.c >> > +++ b/drivers/cpufreq/cpufreq.c >> > @@ -1511,12 +1511,14 @@ int __cpufreq_driver_getavg(struct >> > cpufreq_policy *policy, unsigned int cpu) >> > { >> > int ret = 0; >> > >> > + if (!(cpu_online(cpu) && cpufreq_driver->getavg)) >> > + return 0; >> > + >> > policy = cpufreq_cpu_get(policy->cpu); >> > if (!policy) >> > return -EINVAL; >> > >> > - if (cpu_online(cpu) && cpufreq_driver->getavg) >> > - ret = cpufreq_driver->getavg(policy, cpu); >> > + ret = cpufreq_driver->getavg(policy, cpu); >> > >> > cpufreq_cpu_put(policy); >> > return ret; >> > >> -- >> I speak only for myself. >> Rafael J. Wysocki, Intel Open Source Technology Center.
On Saturday 20 of October 2012 10:12:07 Viresh Kumar wrote: > On Oct 20, 2012 3:37 AM, "Rafael J. Wysocki" <rjw@sisk.pl> wrote: > > > > On Saturday 20 of October 2012 01:42:05 Viresh Kumar wrote: > > > There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for > drivers that > > > don't support getavg() routine. > > > > > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > > > > The patch doesn't seem to follow the changelog or the other way around. > > Sorry if my log isn't clear enough. > But i could still see it matching the code :) > > I have moved the check for drivers capabilities at the top > of routine, so that there is no need to call mentioned routines. OK Applied to linux-pm.git/linux-next as v3.8 material. Thanks, Rafael
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 85df538..f552d5f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1511,12 +1511,14 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) { int ret = 0; + if (!(cpu_online(cpu) && cpufreq_driver->getavg)) + return 0; + policy = cpufreq_cpu_get(policy->cpu); if (!policy) return -EINVAL; - if (cpu_online(cpu) && cpufreq_driver->getavg) - ret = cpufreq_driver->getavg(policy, cpu); + ret = cpufreq_driver->getavg(policy, cpu); cpufreq_cpu_put(policy); return ret;
There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for drivers that don't support getavg() routine. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/cpufreq/cpufreq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)