Skip to content

Commit 5eeaf1f

Browse files
Stratos Karafotisrafaeljw
authored andcommitted
cpufreq: Fix build error on some platforms that use cpufreq_for_each_*
On platforms that use cpufreq_for_each_* macros, build fails if CONFIG_CPU_FREQ=n, e.g. ARM/shmobile/koelsch/non-multiplatform: drivers/built-in.o: In function `clk_round_parent': clkdev.c:(.text+0xcf168): undefined reference to `cpufreq_next_valid' drivers/built-in.o: In function `clk_rate_table_find': clkdev.c:(.text+0xcf820): undefined reference to `cpufreq_next_valid' make[3]: *** [vmlinux] Error 1 Fix this making cpufreq_next_valid function inline and move it to cpufreq.h. Fixes: 27e289d (cpufreq: Introduce macros for cpufreq_frequency_table iteration) Reported-and-tested-by: Geert Uytterhoeven <geert@linux-m68k.org> 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>
1 parent 37c1479 commit 5eeaf1f

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

‎drivers/cpufreq/cpufreq.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,17 +237,6 @@ void cpufreq_cpu_put(struct cpufreq_policy *policy)
237237
}
238238
EXPORT_SYMBOL_GPL(cpufreq_cpu_put);
239239

240-
bool cpufreq_next_valid(struct cpufreq_frequency_table **pos)
241-
{
242-
while ((*pos)->frequency != CPUFREQ_TABLE_END)
243-
if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID)
244-
return true;
245-
else
246-
(*pos)++;
247-
return false;
248-
}
249-
EXPORT_SYMBOL_GPL(cpufreq_next_valid);
250-
251240
/*********************************************************************
252241
* EXTERNALLY AFFECTING FREQUENCY CHANGES *
253242
*********************************************************************/

‎include/linux/cpufreq.h‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,15 @@ static inline void dev_pm_opp_free_cpufreq_table(struct device *dev,
489489
}
490490
#endif
491491

492-
493-
bool cpufreq_next_valid(struct cpufreq_frequency_table **pos);
492+
static inline bool cpufreq_next_valid(struct cpufreq_frequency_table **pos)
493+
{
494+
while ((*pos)->frequency != CPUFREQ_TABLE_END)
495+
if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID)
496+
return true;
497+
else
498+
(*pos)++;
499+
return false;
500+
}
494501

495502
/*
496503
* cpufreq_for_each_entry - iterate over a cpufreq_frequency_table

0 commit comments

Comments
 (0)