aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStratos Karafotis <stratosk@semaphore.gr>2014-04-25 16:16:58 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-04-29 18:07:00 -0400
commit4229e1c61a4a7ac21d5d0790f6add1c9b98d33e7 (patch)
tree6ea8a851517e44946f2614aa0252c4216c136b4c
parent04ae58645afa0b411e129a3de04a1a0aacf89cc5 (diff)
sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
The cpufreq core now 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>
-rw-r--r--drivers/sh/clk/core.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
index 74727851820d..be56b22ca941 100644
--- a/drivers/sh/clk/core.c
+++ b/drivers/sh/clk/core.c
@@ -196,17 +196,11 @@ int clk_rate_table_find(struct clk *clk,
196 struct cpufreq_frequency_table *freq_table, 196 struct cpufreq_frequency_table *freq_table,
197 unsigned long rate) 197 unsigned long rate)
198{ 198{
199 int i; 199 struct cpufreq_frequency_table *pos;
200
201 for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
202 unsigned long freq = freq_table[i].frequency;
203 200
204 if (freq == CPUFREQ_ENTRY_INVALID) 201 cpufreq_for_each_valid_entry(pos, freq_table)
205 continue; 202 if (pos->frequency == rate)
206 203 return pos - freq_table;
207 if (freq == rate)
208 return i;
209 }
210 204
211 return -ENOENT; 205 return -ENOENT;
212} 206}
@@ -575,11 +569,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
575 return abs(target - *best_freq); 569 return abs(target - *best_freq);
576 } 570 }
577 571
578 for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END; 572 cpufreq_for_each_valid_entry(freq, parent->freq_table) {
579 freq++) {
580 if (freq->frequency == CPUFREQ_ENTRY_INVALID)
581 continue;
582
583 if (unlikely(freq->frequency / target <= div_min - 1)) { 573 if (unlikely(freq->frequency / target <= div_min - 1)) {
584 unsigned long freq_max; 574 unsigned long freq_max;
585 575