Skip to contentSkip to conversation

cpufreq: dbx500: Use cpufreq_for_each_entry macro for iteration

PATCH Superseded Stratos Karafotis 2 participants 2 messages Apr 14, 2014 – Apr 15, 2014 CPU frequency scaling framework

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/20 cpufreq: dbx500: Use cpufreq_for_each_entry macro for iteration

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

It should have no functional changes.

---
 drivers/cpufreq/dbx500-cpufreq.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/cpufreq/dbx500-cpufreq.c +3 -4
index 412a78b..2a0635c 100644
@@ -45,7 +45,7 @@ static struct cpufreq_driver dbx500_cpufreq_driver = {
 
 static int dbx500_cpufreq_probe(struct platform_device *pdev)
 {
-	int i = 0;
+	struct cpufreq_frequency_table *pos;
 
 	freq_table = dev_get_platdata(&pdev->dev);
 	if (!freq_table) {
@@ -60,9 +60,8 @@ static int dbx500_cpufreq_probe(struct platform_device *pdev)
 	}
 
 	pr_info("dbx500-cpufreq: Available frequencies:\n");
-	while (freq_table[i].frequency != CPUFREQ_TABLE_END) {
-		pr_info("  %d Mhz\n", freq_table[i].frequency/1000);
-		i++;
+	cpufreq_for_each_entry(pos, freq_table) {
+		pr_info("  %d Mhz\n", pos->frequency / 1000);
 	}
 
 	return cpufreq_register_driver(&dbx500_cpufreq_driver);
Signature · 1 line
1.9.0
maintainer
#1 lore raw
Quoted 24 lines · Stratos Karafotis

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

It should have no functional changes.

---
 drivers/cpufreq/dbx500-cpufreq.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/cpufreq/dbx500-cpufreq.c +1 -1
index 412a78b..2a0635c 100644
@@ -45,7 +45,7 @@ static struct cpufreq_driver dbx500_cpufreq_driver = {
 
 static int dbx500_cpufreq_probe(struct platform_device *pdev)
 {
-       int i = 0;
+       struct cpufreq_frequency_table *pos;
 
        freq_table = dev_get_platdata(&pdev->dev);
        if (!freq_table) {

drivers/cpufreq/dbx500-cpufreq.c static int dbx500_cpufreq_probe(struct platform_device *pdev) · line 65

Quoted 9 lines
drivers/cpufreq/dbx500-cpufreq.c +2 -3
@@ -60,9 +60,8 @@ static int dbx500_cpufreq_probe(struct platform_device *pdev)
        }
 
        pr_info("dbx500-cpufreq: Available frequencies:\n");
-       while (freq_table[i].frequency != CPUFREQ_TABLE_END) {
-               pr_info("  %d Mhz\n", freq_table[i].frequency/1000);
-               i++;
+       cpufreq_for_each_entry(pos, freq_table) {
+               pr_info("  %d Mhz\n", pos->frequency / 1000);
        }

Remove {}