]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cpufreq: Introduce governor flags
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 10 Nov 2020 17:25:57 +0000 (18:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:22:30 +0000 (19:22 +0100)
commit 9a2a9ebc0a758d887ee06e067e9f7f0b36ff7574 upstream.

A new cpufreq governor flag will be added subsequently, so replace
the bool dynamic_switching fleid in struct cpufreq_governor with a
flags field and introduce CPUFREQ_GOV_DYNAMIC_SWITCHING to set for
the "dynamic switching" governors instead of it.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_governor.h
include/linux/cpufreq.h
kernel/sched/cpufreq_schedutil.c

index e97ff004ac6a93d22e47f0bea1f986141345806f..1b50be72e20ade5cce1eaaccb812c5cd5d1db4c2 100644 (file)
@@ -2233,7 +2233,7 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy)
                return -EINVAL;
 
        /* Platform doesn't want dynamic frequency switching ? */
-       if (policy->governor->dynamic_switching &&
+       if (policy->governor->flags & CPUFREQ_GOV_DYNAMIC_SWITCHING &&
            cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING) {
                struct cpufreq_governor *gov = cpufreq_fallback_governor();
 
index c56773c257579fa177866a88c3159964373f3f69..bab8e6140377142d8527ba0ea70ea8bed867cbd7 100644 (file)
@@ -156,7 +156,7 @@ void cpufreq_dbs_governor_limits(struct cpufreq_policy *policy);
 #define CPUFREQ_DBS_GOVERNOR_INITIALIZER(_name_)                       \
        {                                                               \
                .name = _name_,                                         \
-               .dynamic_switching = true,                              \
+               .flags = CPUFREQ_GOV_DYNAMIC_SWITCHING,                 \
                .owner = THIS_MODULE,                                   \
                .init = cpufreq_dbs_governor_init,                      \
                .exit = cpufreq_dbs_governor_exit,                      \
index 2e900fd461f2e933f4c0ddb05a035554cff87bcd..8bd886c16cc49e41228f5489e4b6ef5d40cfd0f9 100644 (file)
@@ -565,12 +565,17 @@ struct cpufreq_governor {
                                         char *buf);
        int     (*store_setspeed)       (struct cpufreq_policy *policy,
                                         unsigned int freq);
-       /* For governors which change frequency dynamically by themselves */
-       bool                    dynamic_switching;
        struct list_head        governor_list;
        struct module           *owner;
+       u8                      flags;
 };
 
+/* Governor flags */
+
+/* For governors which change frequency dynamically by themselves */
+#define CPUFREQ_GOV_DYNAMIC_SWITCHING  BIT(0)
+
+
 /* Pass a target to the cpufreq driver */
 unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
                                        unsigned int target_freq);
index 59d511e326730e1cf9f31a189584c26e923836e1..4e4d052ebaf3817ca1a2e91bf78b2066ba41fd8e 100644 (file)
@@ -896,7 +896,7 @@ static void sugov_limits(struct cpufreq_policy *policy)
 struct cpufreq_governor schedutil_gov = {
        .name                   = "schedutil",
        .owner                  = THIS_MODULE,
-       .dynamic_switching      = true,
+       .flags                  = CPUFREQ_GOV_DYNAMIC_SWITCHING,
        .init                   = sugov_init,
        .exit                   = sugov_exit,
        .start                  = sugov_start,