aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda
diff options
context:
space:
mode:
authorStratos Karafotis <stratosk@semaphore.gr>2014-04-25 16:16:49 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-04-29 18:06:54 -0400
commit04ae58645afa0b411e129a3de04a1a0aacf89cc5 (patch)
tree2cf3d730268343579a499177f67b779d2d1c60e2 /drivers/net/irda
parent3c84ef3af7c5778e25145a1fef29a816730a830c (diff)
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>
Diffstat (limited to 'drivers/net/irda')
-rw-r--r--drivers/net/irda/sh_sir.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c
index cadf52e22464..e3fe9a286136 100644
--- a/drivers/net/irda/sh_sir.c
+++ b/drivers/net/irda/sh_sir.c
@@ -217,21 +217,17 @@ crc_init_out:
217static u32 sh_sir_find_sclk(struct clk *irda_clk) 217static u32 sh_sir_find_sclk(struct clk *irda_clk)
218{ 218{
219 struct cpufreq_frequency_table *freq_table = irda_clk->freq_table; 219 struct cpufreq_frequency_table *freq_table = irda_clk->freq_table;
220 struct cpufreq_frequency_table *pos;
220 struct clk *pclk = clk_get(NULL, "peripheral_clk"); 221 struct clk *pclk = clk_get(NULL, "peripheral_clk");
221 u32 limit, min = 0xffffffff, tmp; 222 u32 limit, min = 0xffffffff, tmp;
222 int i, index = 0; 223 int index = 0;
223 224
224 limit = clk_get_rate(pclk); 225 limit = clk_get_rate(pclk);
225 clk_put(pclk); 226 clk_put(pclk);
226 227
227 /* IrDA can not set over peripheral_clk */ 228 /* IrDA can not set over peripheral_clk */
228 for (i = 0; 229 cpufreq_for_each_valid_entry(pos, freq_table) {
229 freq_table[i].frequency != CPUFREQ_TABLE_END; 230 u32 freq = pos->frequency;
230 i++) {
231 u32 freq = freq_table[i].frequency;
232
233 if (freq == CPUFREQ_ENTRY_INVALID)
234 continue;
235 231
236 /* IrDA should not over peripheral_clk */ 232 /* IrDA should not over peripheral_clk */
237 if (freq > limit) 233 if (freq > limit)
@@ -240,7 +236,7 @@ static u32 sh_sir_find_sclk(struct clk *irda_clk)
240 tmp = freq % SCLK_BASE; 236 tmp = freq % SCLK_BASE;
241 if (tmp < min) { 237 if (tmp < min) {
242 min = tmp; 238 min = tmp;
243 index = i; 239 index = pos - freq_table;
244 } 240 }
245 } 241 }
246 242