diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2013-06-12 09:08:48 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-14 20:09:47 -0400 |
commit | 137b944e100278d696826cf25c83014ac17473fe (patch) | |
tree | c7edaefb1df8cb147dac3ed7dccab5c4bd7e04c1 /drivers/cpuidle/governors/menu.c | |
parent | ad81f0545ef01ea651886dddac4bef6cec930092 (diff) |
cpuidle: Make it clear that governors cannot be modules
cpufreq governors are defined as modules in the code, but the Kconfig
options do not allow them to be built as modules. This is not really
a problem, but the cpuidle init ordering is: the cpuidle init
functions (framework and driver) and then the governors. That leads
to some weirdness in the cpuidle framework.
Namely, cpuidle_register_device() calls cpuidle_enable_device() which
fails at the first attempt, because governors have not been registered
yet. When a governor is registered, the framework calls
cpuidle_enable_device() again which runs __cpuidle_register_device()
only then. Of course, for that to work, the cpuidle_enable_device()
return value has to be ignored by cpuidle_register_device().
Instead of having this cyclic call graph and relying on a positive
side effects of the hackish back and forth cpuidle_enable_device()
calls it is better to fix the cpuidle init ordering.
To that end, replace the module init code with postcore_initcall()
so we have:
* cpuidle framework : core_initcall
* cpuidle governors : postcore_initcall
* cpuidle drivers : device_initcall
and remove the corresponding module exit code as it is dead anyway
(governors can't be built as modules).
[rjw: Changelog]
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/governors/menu.c')
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index fe343a06b7da..743138c309a1 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -540,14 +540,4 @@ static int __init init_menu(void) | |||
540 | return cpuidle_register_governor(&menu_governor); | 540 | return cpuidle_register_governor(&menu_governor); |
541 | } | 541 | } |
542 | 542 | ||
543 | /** | 543 | postcore_initcall(init_menu); |
544 | * exit_menu - exits the governor | ||
545 | */ | ||
546 | static void __exit exit_menu(void) | ||
547 | { | ||
548 | cpuidle_unregister_governor(&menu_governor); | ||
549 | } | ||
550 | |||
551 | MODULE_LICENSE("GPL"); | ||
552 | module_init(init_menu); | ||
553 | module_exit(exit_menu); | ||