Skip to content

Commit 9a2a9eb

Browse files
committed
cpufreq: Introduce governor flags
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>
1 parent f8394f2 commit 9a2a9eb

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

drivers/cpufreq/cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2254,7 +2254,7 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy)
22542254
return -EINVAL;
22552255

22562256
/* Platform doesn't want dynamic frequency switching ? */
2257-
if (policy->governor->dynamic_switching &&
2257+
if (policy->governor->flags & CPUFREQ_GOV_DYNAMIC_SWITCHING &&
22582258
cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING) {
22592259
struct cpufreq_governor *gov = cpufreq_fallback_governor();
22602260

drivers/cpufreq/cpufreq_governor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void cpufreq_dbs_governor_limits(struct cpufreq_policy *policy);
156156
#define CPUFREQ_DBS_GOVERNOR_INITIALIZER(_name_) \
157157
{ \
158158
.name = _name_, \
159-
.dynamic_switching = true, \
159+
.flags = CPUFREQ_GOV_DYNAMIC_SWITCHING, \
160160
.owner = THIS_MODULE, \
161161
.init = cpufreq_dbs_governor_init, \
162162
.exit = cpufreq_dbs_governor_exit, \

include/linux/cpufreq.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,12 +570,17 @@ struct cpufreq_governor {
570570
char *buf);
571571
int (*store_setspeed) (struct cpufreq_policy *policy,
572572
unsigned int freq);
573-
/* For governors which change frequency dynamically by themselves */
574-
bool dynamic_switching;
575573
struct list_head governor_list;
576574
struct module *owner;
575+
u8 flags;
577576
};
578577

578+
/* Governor flags */
579+
580+
/* For governors which change frequency dynamically by themselves */
581+
#define CPUFREQ_GOV_DYNAMIC_SWITCHING BIT(0)
582+
583+
579584
/* Pass a target to the cpufreq driver */
580585
unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
581586
unsigned int target_freq);

kernel/sched/cpufreq_schedutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ static void sugov_limits(struct cpufreq_policy *policy)
881881
struct cpufreq_governor schedutil_gov = {
882882
.name = "schedutil",
883883
.owner = THIS_MODULE,
884-
.dynamic_switching = true,
884+
.flags = CPUFREQ_GOV_DYNAMIC_SWITCHING,
885885
.init = sugov_init,
886886
.exit = sugov_exit,
887887
.start = sugov_start,

0 commit comments

Comments
 (0)