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

cpufreq: sh: Don't validate the frequency table twice

The cpufreq core is already validating the CPU frequency table after
calling the ->init() callback of the cpufreq drivers and the drivers
don't need to do the same anymore. Though they need to set the
policy->freq_table field directly from the ->init() callback now.

Stop validating the frequency table from sh-cpufreq driver.

The driver though prints the min/max frequency values and the same is
done from the ->ready() callback now to keep the behavior unchanged.

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

authored by

Viresh Kumar and committed by
Rafael J. Wysocki
ec8d2cc6 54a277eb

+12 -10
+12 -10
drivers/cpufreq/sh-cpufreq.c
··· 122 122 123 123 freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL; 124 124 if (freq_table) { 125 - int result; 126 - 127 - result = cpufreq_table_validate_and_show(policy, freq_table); 128 - if (result) 129 - return result; 125 + policy->freq_table = freq_table; 130 126 } else { 131 127 dev_notice(dev, "no frequency table found, falling back " 132 128 "to rate rounding.\n"); ··· 132 136 policy->max = policy->cpuinfo.max_freq = 133 137 (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; 134 138 } 135 - 136 - dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, " 137 - "Maximum %u.%03u MHz.\n", 138 - policy->min / 1000, policy->min % 1000, 139 - policy->max / 1000, policy->max % 1000); 140 139 141 140 return 0; 142 141 } ··· 146 155 return 0; 147 156 } 148 157 158 + static void sh_cpufreq_cpu_ready(struct cpufreq_policy *policy) 159 + { 160 + struct device *dev = get_cpu_device(policy->cpu); 161 + 162 + dev_info(dev, "CPU Frequencies - Minimum %u.%03u MHz, " 163 + "Maximum %u.%03u MHz.\n", 164 + policy->min / 1000, policy->min % 1000, 165 + policy->max / 1000, policy->max % 1000); 166 + } 167 + 149 168 static struct cpufreq_driver sh_cpufreq_driver = { 150 169 .name = "sh", 151 170 .flags = CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING, ··· 164 163 .verify = sh_cpufreq_verify, 165 164 .init = sh_cpufreq_cpu_init, 166 165 .exit = sh_cpufreq_cpu_exit, 166 + .ready = sh_cpufreq_cpu_ready, 167 167 .attr = cpufreq_generic_attr, 168 168 }; 169 169