Skip to contentSkip to conversation

davinci: da850: Use cpufreq_for_each_entry macro for iteration

PATCH Superseded Stratos Karafotis 3 participants 3 messages Apr 15, 2014 – Apr 21, 2014

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/8 davinci: da850: Use cpufreq_for_each_entry macro for iteration

The cpufreq core now supports the cpufreq_for_each_entry macro helper for iteration over the cpufreq_frequency_table, so use it.

It should have no functional changes.

---
 arch/arm/mach-davinci/da850.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arm/mach-davinci/da850.c +5 -4
index 85399c9..45ce065 100644
@@ -1092,20 +1092,21 @@ int da850_register_cpufreq(char *async_clk)
 
 static int da850_round_armrate(struct clk *clk, unsigned long rate)
 {
-	int i, ret = 0, diff;
+	int ret = 0, diff;
 	unsigned int best = (unsigned int) -1;
 	struct cpufreq_frequency_table *table = cpufreq_info.freq_table;
+	struct cpufreq_frequency_table *pos;
 
 	rate /= 1000; /* convert to kHz */
 
-	for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
-		diff = table[i].frequency - rate;
+	cpufreq_for_each_entry(pos, table) {
+		diff = pos->frequency - rate;
 		if (diff < 0)
 			diff = -diff;
 
 		if (diff < best) {
 			best = diff;
-			ret = table[i].frequency;
+			ret = pos->frequency;
 		}
 	}
 
Signature · 1 line
1.9.0
#1 lore raw
Quoted 6 lines · Stratos Karafotis

The cpufreq core now supports the cpufreq_for_each_entry macro helper for iteration over the cpufreq_frequency_table, so use it.

It should have no functional changes.

I cannot test this (or even build this) since I do not have the patch which adds cpufreq_for_each_entry(). The change as such looks fine to me. Please prefix the subject line with "ARM: " as is the convention in ARM world.

Thanks,
Sekhar

#2 lore raw
Quoted 4 lines · Sekhar Nori

I cannot test this (or even build this) since I do not have the patch which adds cpufreq_for_each_entry(). The change as such looks fine to me. Please prefix the subject line with "ARM: " as is the convention in ARM world.

In case you wanna have a look:

https://lkml.org/lkml/2014/4/15/695