Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: drivers: Remove unnecessary assignments of policy-> members

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.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Viresh Kumar and committed by
Rafael J. Wysocki
eb2f50ff 8a00627a

+16 -30
+3 -2
Documentation/cpu-freq/cpu-drivers.txt
··· 108 108 cpufreq_driver.target is called with 109 109 these values. 110 110 111 - For setting some of these values, the frequency table helpers might be 112 - helpful. See the section 2 for more information on them. 111 + For setting some of these values (cpuinfo.min[max]_freq, policy->min[max]), the 112 + frequency table helpers might be helpful. See the section 2 for more information 113 + on them. 113 114 114 115 SMP systems normally have same clock source for a group of cpus. For these the 115 116 .init() would be called only once for the first online cpu. Here the .init()
+7 -12
arch/arm/mach-davinci/cpufreq.c
··· 137 137 return result; 138 138 } 139 139 140 - policy->cur = policy->min = policy->max = davinci_getspeed(0); 140 + policy->cur = davinci_getspeed(0); 141 141 142 - if (freq_table) { 143 - result = cpufreq_frequency_table_cpuinfo(policy, freq_table); 144 - if (!result) 145 - cpufreq_frequency_table_get_attr(freq_table, 146 - policy->cpu); 147 - } else { 148 - policy->cpuinfo.min_freq = policy->min; 149 - policy->cpuinfo.max_freq = policy->max; 142 + result = cpufreq_frequency_table_cpuinfo(policy, freq_table); 143 + if (result) { 144 + pr_err("%s: cpufreq_frequency_table_cpuinfo() failed", 145 + __func__); 146 + return result; 150 147 } 151 148 152 - policy->min = policy->cpuinfo.min_freq; 153 - policy->max = policy->cpuinfo.max_freq; 154 - policy->cur = davinci_getspeed(0); 149 + cpufreq_frequency_table_get_attr(freq_table, policy->cpu); 155 150 156 151 /* 157 152 * Time measurement across the target() function yields ~1500-1800us
-3
arch/arm/mach-imx/cpufreq.c
··· 144 144 imx_freq_table[i].frequency = CPUFREQ_TABLE_END; 145 145 146 146 policy->cur = clk_get_rate(cpu_clk) / 1000; 147 - policy->min = policy->cpuinfo.min_freq = cpu_freq_khz_min; 148 - policy->max = policy->cpuinfo.max_freq = cpu_freq_khz_max; 149 147 150 148 /* Manual states, that PLL stabilizes in two CLK32 periods */ 151 149 policy->cpuinfo.transition_latency = 2 * NANOSECOND / CLK32_FREQ; 152 150 153 151 ret = cpufreq_frequency_table_cpuinfo(policy, imx_freq_table); 154 - 155 152 if (ret < 0) { 156 153 printk(KERN_ERR "%s: failed to register i.MXC CPUfreq with error code %d\n", 157 154 __func__, ret);
+3 -6
arch/sh/kernel/cpufreq.c
··· 116 116 return PTR_ERR(cpuclk); 117 117 } 118 118 119 - policy->cur = policy->min = policy->max = sh_cpufreq_get(cpu); 119 + policy->cur = sh_cpufreq_get(cpu); 120 120 121 121 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL; 122 122 if (freq_table) { ··· 129 129 dev_notice(dev, "no frequency table found, falling back " 130 130 "to rate rounding.\n"); 131 131 132 - policy->cpuinfo.min_freq = 132 + policy->min = policy->cpuinfo.min_freq = 133 133 (clk_round_rate(cpuclk, 1) + 500) / 1000; 134 - policy->cpuinfo.max_freq = 134 + policy->max = policy->cpuinfo.max_freq = 135 135 (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; 136 136 } 137 - 138 - policy->min = policy->cpuinfo.min_freq; 139 - policy->max = policy->cpuinfo.max_freq; 140 137 141 138 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 142 139
+2 -4
drivers/cpufreq/cpufreq-nforce2.c
··· 359 359 min_fsb = NFORCE2_MIN_FSB; 360 360 361 361 /* cpuinfo and default policy values */ 362 - policy->cpuinfo.min_freq = min_fsb * fid * 100; 363 - policy->cpuinfo.max_freq = max_fsb * fid * 100; 362 + policy->min = policy->cpuinfo.min_freq = min_fsb * fid * 100; 363 + policy->max = policy->cpuinfo.max_freq = max_fsb * fid * 100; 364 364 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 365 365 policy->cur = nforce2_get(policy->cpu); 366 - policy->min = policy->cpuinfo.min_freq; 367 - policy->max = policy->cpuinfo.max_freq; 368 366 369 367 return 0; 370 368 }
+1 -3
drivers/cpufreq/omap-cpufreq.c
··· 177 177 goto fail_ck; 178 178 } 179 179 180 - policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu); 180 + policy->cur = omap_getspeed(policy->cpu); 181 181 182 182 if (!freq_table) 183 183 result = opp_init_cpufreq_table(mpu_dev, &freq_table); ··· 196 196 197 197 cpufreq_frequency_table_get_attr(freq_table, policy->cpu); 198 198 199 - policy->min = policy->cpuinfo.min_freq; 200 - policy->max = policy->cpuinfo.max_freq; 201 199 policy->cur = omap_getspeed(policy->cpu); 202 200 203 201 /*