sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
PATCH v2 8/8 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.
--- drivers/sh/clk/core.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/sh/clk/core.c +5 -15
@@ -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;
Signature · 1 line
1.9.0
Quoted 6 lines · Stratos Karafotis
The cpufreq core now supports the
cpufreq_for_each_valid_entrymacro helper for iteration over thecpufreq_frequency_table, so use it.It should have no functional changes.
Signed-off-by Stratos Karafotis <[email protected]>
Thanks, I have queued this up.
Quoted 9 lines · Simon Horman
Quoted 6 lines · Stratos Karafotis
The cpufreq core now supports the
cpufreq_for_each_valid_entrymacro helper for iteration over thecpufreq_frequency_table, so use it.It should have no functional changes.
Signed-off-by Stratos Karafotis <[email protected]>Thanks, I have queued this up.
I have dropped this patch.
Please let me know if there is a stable branch which includes cpufreq_frequency_table which I can use as a base to apply this patch.
Alternatively, I would be happy to Ack this patch and let someone else pick up this patch, but I'm entirely unclear on who that would be.
Quoted 8 lines · Simon Horman
I have dropped this patch.
Please let me know if there is a stable branch which includes
cpufreq_frequency_tablewhich I can use as a base to apply this patch.Alternatively, I would be happy to Ack this patch and let someone else pick up this patch, but I'm entirely unclear on who that would be.
Rafael will take this patch, please Ack it :)
Quoted 11 lines · Viresh Kumar
Quoted 8 lines · Simon Horman
I have dropped this patch.
Please let me know if there is a stable branch which includes
cpufreq_frequency_tablewhich I can use as a base to apply this patch.Alternatively, I would be happy to Ack this patch and let someone else pick up this patch, but I'm entirely unclear on who that would be.
Rafael will take this patch, please Ack it :)
Thanks, done.
Quoted 6 lines · Stratos Karafotis
The cpufreq core now supports the
cpufreq_for_each_valid_entrymacro helper for iteration over thecpufreq_frequency_table, so use it.It should have no functional changes.
Signed-off-by Stratos Karafotis <[email protected]>
Rafael, please feel free to take this one.
Quoted 46 lines
--- drivers/sh/clk/core.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)drivers/sh/clk/core.c +5
-15@@ -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;Signature · 1 line
1.9.0
Quoted 4 lines · Simon Horman
Quoted 3 lines · Stratos Karafotis
The cpufreq core now supports the
cpufreq_for_each_valid_entrymacro helper for iteration over thecpufreq_frequency_table, so use it.
Quoted 8 lines
Quoted 3 lines
It should have no functional changes.
Signed-off-by Stratos Karafotis <[email protected]>Rafael, please feel free to take this one.
Acked-by Simon Horman <[email protected]>
Thanks!
Stratos
PATCH v4 8/8 sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
In reply to Stratos KarafotisThe 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.
--- drivers/sh/clk/core.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/sh/clk/core.c +5 -15
@@ -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;
Signature · 1 line
1.9.0