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

irda: sh_sir: Use cpufreq_for_each_valid_entry macro for iteration

The cpufreq core supports the cpufreq_for_each_valid_entry macro
helper for iteration over the cpufreq_frequency_table, so use it.

It should have no functional changes.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Stratos Karafotis and committed by
Rafael J. Wysocki
04ae5864 3c84ef3a

+5 -9
+5 -9
drivers/net/irda/sh_sir.c
··· 217 217 static u32 sh_sir_find_sclk(struct clk *irda_clk) 218 218 { 219 219 struct cpufreq_frequency_table *freq_table = irda_clk->freq_table; 220 + struct cpufreq_frequency_table *pos; 220 221 struct clk *pclk = clk_get(NULL, "peripheral_clk"); 221 222 u32 limit, min = 0xffffffff, tmp; 222 - int i, index = 0; 223 + int index = 0; 223 224 224 225 limit = clk_get_rate(pclk); 225 226 clk_put(pclk); 226 227 227 228 /* IrDA can not set over peripheral_clk */ 228 - for (i = 0; 229 - freq_table[i].frequency != CPUFREQ_TABLE_END; 230 - i++) { 231 - u32 freq = freq_table[i].frequency; 232 - 233 - if (freq == CPUFREQ_ENTRY_INVALID) 234 - continue; 229 + cpufreq_for_each_valid_entry(pos, freq_table) { 230 + u32 freq = pos->frequency; 235 231 236 232 /* IrDA should not over peripheral_clk */ 237 233 if (freq > limit) ··· 236 240 tmp = freq % SCLK_BASE; 237 241 if (tmp < min) { 238 242 min = tmp; 239 - index = i; 243 + index = pos - freq_table; 240 244 } 241 245 } 242 246