lkml.org 
[lkml]   [2014]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
On Wed, Apr 16, 2014 at 01:27:04AM +0300, Stratos Karafotis wrote:
> 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>

Rafael, please feel free to take this one.

Acked-by: Simon Horman <horms+renesas@verge.net.au>

> ---
> drivers/sh/clk/core.c | 20 +++++---------------
> 1 file changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
> index 7472785..be56b22 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;
>
> --
> 1.9.0
>


\
 
 \ /
  Last update: 2014-04-16 07:01    [W:0.063 / U:0.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site