diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-09-07 21:40:34 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-09-25 20:59:38 -0400 |
commit | 03d5eec000973e80b1a1ccdef16ed8206621c3e4 (patch) | |
tree | 9b24d4e813e485a53d4c0027a122763cd76deb32 | |
parent | 78ce6dbfa317c85cfb8a8dc0b5ee588645c795c1 (diff) |
cpufreq: conservative: remove 'enable' field
Conservative governor has its own 'enable' field to check if
conservative governor is used for a CPU or not
This can be checked by policy->governor with 'cpufreq_gov_conservative'
and so this field can be dropped.
Because its not guaranteed that dbs_info->cdbs.shared will a valid
pointer for all CPUs (will be NULL for CPUs that don't use
ondemand/conservative governors), we can't use it anymore. Lets get
policy with cpufreq_cpu_get_raw() instead.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 31 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 12 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.h | 1 |
3 files changed, 19 insertions, 25 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 84a1506950a7..1fa1deb6e91f 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -23,6 +23,19 @@ | |||
23 | 23 | ||
24 | static DEFINE_PER_CPU(struct cs_cpu_dbs_info_s, cs_cpu_dbs_info); | 24 | static DEFINE_PER_CPU(struct cs_cpu_dbs_info_s, cs_cpu_dbs_info); |
25 | 25 | ||
26 | static int cs_cpufreq_governor_dbs(struct cpufreq_policy *policy, | ||
27 | unsigned int event); | ||
28 | |||
29 | #ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE | ||
30 | static | ||
31 | #endif | ||
32 | struct cpufreq_governor cpufreq_gov_conservative = { | ||
33 | .name = "conservative", | ||
34 | .governor = cs_cpufreq_governor_dbs, | ||
35 | .max_transition_latency = TRANSITION_LATENCY_LIMIT, | ||
36 | .owner = THIS_MODULE, | ||
37 | }; | ||
38 | |||
26 | static inline unsigned int get_freq_target(struct cs_dbs_tuners *cs_tuners, | 39 | static inline unsigned int get_freq_target(struct cs_dbs_tuners *cs_tuners, |
27 | struct cpufreq_policy *policy) | 40 | struct cpufreq_policy *policy) |
28 | { | 41 | { |
@@ -119,12 +132,14 @@ static int dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
119 | struct cpufreq_freqs *freq = data; | 132 | struct cpufreq_freqs *freq = data; |
120 | struct cs_cpu_dbs_info_s *dbs_info = | 133 | struct cs_cpu_dbs_info_s *dbs_info = |
121 | &per_cpu(cs_cpu_dbs_info, freq->cpu); | 134 | &per_cpu(cs_cpu_dbs_info, freq->cpu); |
122 | struct cpufreq_policy *policy; | 135 | struct cpufreq_policy *policy = cpufreq_cpu_get_raw(freq->cpu); |
123 | 136 | ||
124 | if (!dbs_info->enable) | 137 | if (!policy) |
125 | return 0; | 138 | return 0; |
126 | 139 | ||
127 | policy = dbs_info->cdbs.shared->policy; | 140 | /* policy isn't governed by conservative governor */ |
141 | if (policy->governor != &cpufreq_gov_conservative) | ||
142 | return 0; | ||
128 | 143 | ||
129 | /* | 144 | /* |
130 | * we only care if our internally tracked freq moves outside the 'valid' | 145 | * we only care if our internally tracked freq moves outside the 'valid' |
@@ -367,16 +382,6 @@ static int cs_cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
367 | return cpufreq_governor_dbs(policy, &cs_dbs_cdata, event); | 382 | return cpufreq_governor_dbs(policy, &cs_dbs_cdata, event); |
368 | } | 383 | } |
369 | 384 | ||
370 | #ifndef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE | ||
371 | static | ||
372 | #endif | ||
373 | struct cpufreq_governor cpufreq_gov_conservative = { | ||
374 | .name = "conservative", | ||
375 | .governor = cs_cpufreq_governor_dbs, | ||
376 | .max_transition_latency = TRANSITION_LATENCY_LIMIT, | ||
377 | .owner = THIS_MODULE, | ||
378 | }; | ||
379 | |||
380 | static int __init cpufreq_gov_dbs_init(void) | 385 | static int __init cpufreq_gov_dbs_init(void) |
381 | { | 386 | { |
382 | return cpufreq_register_governor(&cpufreq_gov_conservative); | 387 | return cpufreq_register_governor(&cpufreq_gov_conservative); |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 939197ffa4ac..750626d8fb03 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -463,7 +463,6 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy, | |||
463 | cdata->get_cpu_dbs_info_s(cpu); | 463 | cdata->get_cpu_dbs_info_s(cpu); |
464 | 464 | ||
465 | cs_dbs_info->down_skip = 0; | 465 | cs_dbs_info->down_skip = 0; |
466 | cs_dbs_info->enable = 1; | ||
467 | cs_dbs_info->requested_freq = policy->cur; | 466 | cs_dbs_info->requested_freq = policy->cur; |
468 | } else { | 467 | } else { |
469 | struct od_ops *od_ops = cdata->gov_ops; | 468 | struct od_ops *od_ops = cdata->gov_ops; |
@@ -482,9 +481,7 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy, | |||
482 | static int cpufreq_governor_stop(struct cpufreq_policy *policy, | 481 | static int cpufreq_governor_stop(struct cpufreq_policy *policy, |
483 | struct dbs_data *dbs_data) | 482 | struct dbs_data *dbs_data) |
484 | { | 483 | { |
485 | struct common_dbs_data *cdata = dbs_data->cdata; | 484 | struct cpu_dbs_info *cdbs = dbs_data->cdata->get_cpu_cdbs(policy->cpu); |
486 | unsigned int cpu = policy->cpu; | ||
487 | struct cpu_dbs_info *cdbs = cdata->get_cpu_cdbs(cpu); | ||
488 | struct cpu_common_dbs_info *shared = cdbs->shared; | 485 | struct cpu_common_dbs_info *shared = cdbs->shared; |
489 | 486 | ||
490 | /* State should be equivalent to START */ | 487 | /* State should be equivalent to START */ |
@@ -493,13 +490,6 @@ static int cpufreq_governor_stop(struct cpufreq_policy *policy, | |||
493 | 490 | ||
494 | gov_cancel_work(dbs_data, policy); | 491 | gov_cancel_work(dbs_data, policy); |
495 | 492 | ||
496 | if (cdata->governor == GOV_CONSERVATIVE) { | ||
497 | struct cs_cpu_dbs_info_s *cs_dbs_info = | ||
498 | cdata->get_cpu_dbs_info_s(cpu); | ||
499 | |||
500 | cs_dbs_info->enable = 0; | ||
501 | } | ||
502 | |||
503 | shared->policy = NULL; | 493 | shared->policy = NULL; |
504 | mutex_destroy(&shared->timer_mutex); | 494 | mutex_destroy(&shared->timer_mutex); |
505 | return 0; | 495 | return 0; |
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 50f171796632..5621bb03e874 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
@@ -170,7 +170,6 @@ struct cs_cpu_dbs_info_s { | |||
170 | struct cpu_dbs_info cdbs; | 170 | struct cpu_dbs_info cdbs; |
171 | unsigned int down_skip; | 171 | unsigned int down_skip; |
172 | unsigned int requested_freq; | 172 | unsigned int requested_freq; |
173 | unsigned int enable:1; | ||
174 | }; | 173 | }; |
175 | 174 | ||
176 | /* Per policy Governors sysfs tunables */ | 175 | /* Per policy Governors sysfs tunables */ |