diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-02-18 02:21:21 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-03-09 14:41:07 +0100 |
commit | 702c9e542a25cf95683c08c56e711eddb80020ac (patch) | |
tree | 245a4ac07166204e1aee917cc2b5057ec28eed16 /drivers/cpufreq/cpufreq_governor.c | |
parent | 8847e038c1d19c20dda0d7a590e31ffa528da8a5 (diff) | |
download | lwn-702c9e542a25cf95683c08c56e711eddb80020ac.tar.gz lwn-702c9e542a25cf95683c08c56e711eddb80020ac.zip |
cpufreq: governor: Add a ->start callback for governors
To avoid having to check the governor type explicitly in the common
code in order to initialize data structures specific to the governor
type properly, add a ->start callback to struct dbs_governor and
use it to initialize those data structures for the ondemand and
conservative governors.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/cpufreq/cpufreq_governor.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 60268160e0ad..badbd467e5e2 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -517,7 +517,7 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy) struct dbs_governor *gov = dbs_governor_of(policy); struct policy_dbs_info *policy_dbs = policy->governor_data; struct dbs_data *dbs_data = policy_dbs->dbs_data; - unsigned int sampling_rate, ignore_nice, j, cpu = policy->cpu; + unsigned int sampling_rate, ignore_nice, j; unsigned int io_busy; if (!policy->cur) @@ -543,19 +543,7 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy) j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; } - if (gov->governor == GOV_CONSERVATIVE) { - struct cs_cpu_dbs_info_s *cs_dbs_info = - gov->get_cpu_dbs_info_s(cpu); - - cs_dbs_info->down_skip = 0; - cs_dbs_info->requested_freq = policy->cur; - } else { - struct od_ops *od_ops = gov->gov_ops; - struct od_cpu_dbs_info_s *od_dbs_info = gov->get_cpu_dbs_info_s(cpu); - - od_dbs_info->sample_type = OD_NORMAL_SAMPLE; - od_ops->powersave_bias_init_cpu(cpu); - } + gov->start(policy); gov_set_update_util(policy_dbs, sampling_rate); return 0; |