[PATCH 14/14] sched: cpufreq: Modularize schedutil

From: Quentin Perret
Date: Thu May 07 2020 - 14:10:58 EST


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@xxxxxxxxxx>
---
drivers/cpufreq/Kconfig | 2 +-
kernel/sched/cpufreq_schedutil.c | 15 ++++++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)

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");
--
2.26.2.526.g744177e7f7-goog