Skip to content

Commit c539b68

Browse files
rafaeljwgregkh
authored andcommitted
cpufreq: Introduce governor flags
commit 9a2a9eb 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>
1 parent f3cbfd0 commit c539b68

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
@@ -2233,7 +2233,7 @@ static int cpufreq_init_governor(struct cpufreq_policy *policy)
22332233
return -EINVAL;
22342234

22352235
/* Platform doesn't want dynamic frequency switching ? */
2236-
if (policy->governor->dynamic_switching &&
2236+
if (policy->governor->flags & CPUFREQ_GOV_DYNAMIC_SWITCHING &&
22372237
cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING) {
22382238
struct cpufreq_governor *gov = cpufreq_fallback_governor();
22392239

‎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
@@ -565,12 +565,17 @@ struct cpufreq_governor {
565565
char *buf);
566566
int (*store_setspeed) (struct cpufreq_policy *policy,
567567
unsigned int freq);
568-
/* For governors which change frequency dynamically by themselves */
569-
bool dynamic_switching;
570568
struct list_head governor_list;
571569
struct module *owner;
570+
u8 flags;
572571
};
573572

573+
/* Governor flags */
574+
575+
/* For governors which change frequency dynamically by themselves */
576+
#define CPUFREQ_GOV_DYNAMIC_SWITCHING BIT(0)
577+
578+
574579
/* Pass a target to the cpufreq driver */
575580
unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
576581
unsigned int target_freq);

‎kernel/sched/cpufreq_schedutil.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ static void sugov_limits(struct cpufreq_policy *policy)
896896
struct cpufreq_governor schedutil_gov = {
897897
.name = "schedutil",
898898
.owner = THIS_MODULE,
899-
.dynamic_switching = true,
899+
.flags = CPUFREQ_GOV_DYNAMIC_SWITCHING,
900900
.init = sugov_init,
901901
.exit = sugov_exit,
902902
.start = sugov_start,

0 commit comments

Comments
 (0)