summaryrefslogtreecommitdiff
path: root/drivers/cpufreq/cpufreq_ondemand.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-02-18 02:21:21 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-09 14:41:07 +0100
commit702c9e542a25cf95683c08c56e711eddb80020ac (patch)
tree245a4ac07166204e1aee917cc2b5057ec28eed16 /drivers/cpufreq/cpufreq_ondemand.c
parent8847e038c1d19c20dda0d7a590e31ffa528da8a5 (diff)
downloadlwn-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_ondemand.c')
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 330b5884b99b..de069f80b619 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -410,6 +410,15 @@ static void od_exit(struct dbs_data *dbs_data, bool notify)
kfree(dbs_data->tuners);
}
+static void od_start(struct cpufreq_policy *policy)
+{
+ unsigned int cpu = policy->cpu;
+ struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
+
+ dbs_info->sample_type = OD_NORMAL_SAMPLE;
+ od_ops.powersave_bias_init_cpu(cpu);
+}
+
define_get_cpu_dbs_routines(od_cpu_dbs_info);
static struct od_ops od_ops = {
@@ -432,6 +441,7 @@ static struct dbs_governor od_dbs_gov = {
.gov_ops = &od_ops,
.init = od_init,
.exit = od_exit,
+ .start = od_start,
};
#define CPU_FREQ_GOV_ONDEMAND (&od_dbs_gov.gov)