Re: [PATCH 2/2] cpufreq: drivers: Remove unnecessary assignments of policy-> members

Sekhar Nori
2013-03-25T08:36:17Z

On 3/24/2013 8:59 PM, Viresh Kumar wrote:
> Some assignments of policy-> min/max/cur/cpuinfo.min_freq/cpuinfo.max_freq
> aren't required as part of it is done by cpufreq driver or cpufreq core.
>
> Remove them.
>
> At some places we merge multiple lines together too.
>
> Cc: Sekhar Nori <nsekhar@ti.com>
> Cc: Sascha Hauer <kernel@pengutronix.de>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Cc: linux-sh@vger.kernel.org
> Cc: linux-omap@vger.kernel.org
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> Documentation/cpu-freq/cpu-drivers.txt | 5 +++--
> arch/arm/mach-davinci/cpufreq.c | 4 ----
> arch/arm/mach-imx/cpufreq.c | 3 ---
> arch/sh/kernel/cpufreq.c | 9 +++------
> drivers/cpufreq/cpufreq-nforce2.c | 6 ++----
> drivers/cpufreq/omap-cpufreq.c | 4 +---
> 6 files changed, 9 insertions(+), 22 deletions(-)
>
> diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt
> index 72f70b1..c94383f 100644
> --- a/Documentation/cpu-freq/cpu-drivers.txt
> +++ b/Documentation/cpu-freq/cpu-drivers.txt
> @@ -108,8 +108,9 @@ policy->governor must contain the "default policy" for
> cpufreq_driver.target is called with
> these values.
>
> -For setting some of these values, the frequency table helpers might be
> -helpful. See the section 2 for more information on them.
> +For setting some of these values (cpuinfo.min[max]_freq, policy->min[max]), the
> +frequency table helpers might be helpful. See the section 2 for more information
> +on them.
>
> SMP systems normally have same clock source for a group of cpus. For these the
> .init() would be called only once for the first online cpu. Here the .init()
> diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
> index 8fb0c2a..ff46862 100644
> --- a/arch/arm/mach-davinci/cpufreq.c
> +++ b/arch/arm/mach-davinci/cpufreq.c
> @@ -149,10 +149,6 @@ static int davinci_cpu_init(struct cpufreq_policy *policy)
> policy->cpuinfo.max_freq = policy->max;
> }
>
> - policy->min = policy->cpuinfo.min_freq;
> - policy->max = policy->cpuinfo.max_freq;
> - policy->cur = davinci_getspeed(0);

There is a line in the code a little above the ones you deleted that
also sets these same variables. I guess you were relying on that line to
set policy->cur, but that also sets policy->{min, max} which can be
cleaned up.

Thanks,
Sekhar