[14/14] sched: cpufreq: Modularize schedutil

Message ID 20200507181012.29791-15-qperret@google.com
State New
Headers show
Series
  • Untitled series #38279
Related show

Commit Message

Quentin Perret May 7, 2020, 6:10 p.m.
Now that all requirements to modularize schedutil are met, make the
Kconfig option tristate and add the missing MODULE_*() declarations in
cpufreq_schedutil.c.

Signed-off-by: Quentin Perret <qperret@google.com>
---
 drivers/cpufreq/Kconfig          |  2 +-
 kernel/sched/cpufreq_schedutil.c | 15 ++++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

Patch

diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index c3e6bd59e920..49942f422a57 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -185,7 +185,7 @@  config CPU_FREQ_GOV_CONSERVATIVE
 	  If in doubt, say N.
 
 config CPU_FREQ_GOV_SCHEDUTIL
-	bool "'schedutil' cpufreq policy governor"
+	tristate "'schedutil' cpufreq policy governor"
 	depends on CPU_FREQ && SMP
 	select CPU_FREQ_GOV_ATTR_SET
 	select IRQ_WORK
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index aeb04cc5b740..ea2778422efd 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -786,15 +786,20 @@  struct cpufreq_governor schedutil_gov = {
 #endif /* CONFIG_ENERGY_MODEL */
 };
 
+static int __init sugov_register(void)
+{
+	return cpufreq_register_governor(&schedutil_gov);
+}
+
 #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL
 struct cpufreq_governor *cpufreq_default_governor(void)
 {
 	return &schedutil_gov;
 }
+core_initcall(sugov_register);
+#else
+module_init(sugov_register);
 #endif
 
-static int __init sugov_register(void)
-{
-	return cpufreq_register_governor(&schedutil_gov);
-}
-core_initcall(sugov_register);
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Schedutil CPUFreq Governor");