cpufreq: Register governors at core_initcall
Currently, most CPUFreq governors are registered at the core_initcall time when the given governor is the default one, and the module_init time otherwise. In preparation for letting users specify the default governor on the kernel command line, change all of them to be registered at the core_initcall unconditionally, as it is already the case for the schedutil and performance governors. This will allow us to assume that builtin governors have been registered before the built-in CPUFreq drivers probe. And since all governors have similar init/exit patterns now, introduce two new macros, cpufreq_governor_{init,exit}(), to factorize the code. Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Quentin Perret <qperret@google.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> [ rjw: Changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:

committed by
Rafael J. Wysocki

parent
8cc46ae565
commit
10dd8573b0
@@ -577,6 +577,20 @@ unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy);
|
||||
int cpufreq_register_governor(struct cpufreq_governor *governor);
|
||||
void cpufreq_unregister_governor(struct cpufreq_governor *governor);
|
||||
|
||||
#define cpufreq_governor_init(__governor) \
|
||||
static int __init __governor##_init(void) \
|
||||
{ \
|
||||
return cpufreq_register_governor(&__governor); \
|
||||
} \
|
||||
core_initcall(__governor##_init)
|
||||
|
||||
#define cpufreq_governor_exit(__governor) \
|
||||
static void __exit __governor##_exit(void) \
|
||||
{ \
|
||||
return cpufreq_unregister_governor(&__governor); \
|
||||
} \
|
||||
module_exit(__governor##_exit)
|
||||
|
||||
struct cpufreq_governor *cpufreq_default_governor(void);
|
||||
struct cpufreq_governor *cpufreq_fallback_governor(void);
|
||||
|
||||
|
Reference in New Issue
Block a user