diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-01-31 12:28:02 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-01 19:02:44 -0500 |
commit | 4447266b842d27f77b017a59eb9dc38ad7b299f1 (patch) | |
tree | f8ae835b7ecee18948afabd75633ea7676b6a4ac /drivers/cpufreq/cpufreq_governor.c | |
parent | 8eeed0956615294200be783bb67d851280b5b1b9 (diff) |
cpufreq: governors: Remove code redundancy between governors
With the inclusion of following patches:
9f4eb10 cpufreq: conservative: call dbs_check_cpu only when necessary
772b4b1 cpufreq: ondemand: call dbs_check_cpu only when necessary
code redundancy between the conservative and ondemand governors is
introduced again, so get rid of it.
[rjw: Changelog]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_governor.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 29d6a59b1a15..7aaa9b151940 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -177,6 +177,25 @@ static inline void dbs_timer_exit(struct dbs_data *dbs_data, int cpu) | |||
177 | cancel_delayed_work_sync(&cdbs->work); | 177 | cancel_delayed_work_sync(&cdbs->work); |
178 | } | 178 | } |
179 | 179 | ||
180 | /* Will return if we need to evaluate cpu load again or not */ | ||
181 | bool need_load_eval(struct cpu_dbs_common_info *cdbs, | ||
182 | unsigned int sampling_rate) | ||
183 | { | ||
184 | if (policy_is_shared(cdbs->cur_policy)) { | ||
185 | ktime_t time_now = ktime_get(); | ||
186 | s64 delta_us = ktime_us_delta(time_now, cdbs->time_stamp); | ||
187 | |||
188 | /* Do nothing if we recently have sampled */ | ||
189 | if (delta_us < (s64)(sampling_rate / 2)) | ||
190 | return false; | ||
191 | else | ||
192 | cdbs->time_stamp = time_now; | ||
193 | } | ||
194 | |||
195 | return true; | ||
196 | } | ||
197 | EXPORT_SYMBOL_GPL(need_load_eval); | ||
198 | |||
180 | int cpufreq_governor_dbs(struct dbs_data *dbs_data, | 199 | int cpufreq_governor_dbs(struct dbs_data *dbs_data, |
181 | struct cpufreq_policy *policy, unsigned int event) | 200 | struct cpufreq_policy *policy, unsigned int event) |
182 | { | 201 | { |