summaryrefslogtreecommitdiff
path: root/drivers/sh
diff options
context:
space:
mode:
authorStratos Karafotis <stratosk@semaphore.gr>2014-04-25 23:16:58 +0300
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>2015-02-04 11:14:31 +0100
commit155447bad7fbc03b63cce3d30f316f8089d1a5bc (patch)
tree841d9cf84a1f9272b514727558604e5dc33703c7 /drivers/sh
parent323d80dff930ab6555e38f9984581685cb00f084 (diff)
downloadkernel-common-155447bad7fbc03b63cce3d30f316f8089d1a5bc.tar.gz
kernel-common-155447bad7fbc03b63cce3d30f316f8089d1a5bc.tar.bz2
kernel-common-155447bad7fbc03b63cce3d30f316f8089d1a5bc.zip
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> (cherry picked from commit 4229e1c61a4a7ac21d5d0790f6add1c9b98d33e7) Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'drivers/sh')
-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,
struct cpufreq_frequency_table *freq_table,
unsigned long rate)
{
- int i;
-
- for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
- unsigned long freq = freq_table[i].frequency;
+ struct cpufreq_frequency_table *pos;
- if (freq == CPUFREQ_ENTRY_INVALID)
- continue;
-
- if (freq == rate)
- return i;
- }
+ cpufreq_for_each_valid_entry(pos, freq_table)
+ if (pos->frequency == rate)
+ return pos - freq_table;
return -ENOENT;
}
@@ -575,11 +569,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
return abs(target - *best_freq);
}
- for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END;
- freq++) {
- if (freq->frequency == CPUFREQ_ENTRY_INVALID)
- continue;
-
+ cpufreq_for_each_valid_entry(freq, parent->freq_table) {
if (unlikely(freq->frequency / target <= div_min - 1)) {
unsigned long freq_max;