summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq_conservative.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-07-18 11:31:00 +0530
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-07-21 01:12:01 +0200
commit43e0ee361e96229959c2ce1eda1ad9d6b3c191b2 (patch)
treebd04b0131c147d042daeb5501da4e3a1ce90dabe /drivers/cpufreq/cpufreq_conservative.c
parent44152cb82d1ad6ae6f8b47c5437f6f1e65ca82c4 (diff)
downloadlinux-43e0ee361e96229959c2ce1eda1ad9d6b3c191b2.tar.gz
linux-43e0ee361e96229959c2ce1eda1ad9d6b3c191b2.tar.bz2
linux-43e0ee361e96229959c2ce1eda1ad9d6b3c191b2.zip
cpufreq: governor: split out common part of {cs|od}_dbs_timer()
Some part of cs_dbs_timer() and od_dbs_timer() is exactly same and is unnecessarily duplicated. Create the real work-handler in cpufreq_governor.c and put the common code in this routine (dbs_timer()). Shouldn't make any functional change. Reviewed-and-tested-by: Preeti U Murthy <preeti@linux.vnet.ibm.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_conservative.c')
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index d21c3cff9056..84a1506950a7 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -102,28 +102,15 @@ static void cs_check_cpu(int cpu, unsigned int load)
}
}
-static void cs_dbs_timer(struct work_struct *work)
+static unsigned int cs_dbs_timer(struct cpu_dbs_info *cdbs,
+ struct dbs_data *dbs_data, bool modify_all)
{
- struct cs_cpu_dbs_info_s *dbs_info = container_of(work,
- struct cs_cpu_dbs_info_s, cdbs.dwork.work);
- struct cpufreq_policy *policy = dbs_info->cdbs.shared->policy;
- unsigned int cpu = policy->cpu;
- struct cs_cpu_dbs_info_s *core_dbs_info = &per_cpu(cs_cpu_dbs_info,
- cpu);
- struct dbs_data *dbs_data = policy->governor_data;
struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
- int delay = delay_for_sampling_rate(cs_tuners->sampling_rate);
- bool modify_all = true;
-
- mutex_lock(&core_dbs_info->cdbs.shared->timer_mutex);
- if (!need_load_eval(core_dbs_info->cdbs.shared,
- cs_tuners->sampling_rate))
- modify_all = false;
- else
- dbs_check_cpu(dbs_data, cpu);
-
- gov_queue_work(dbs_data, policy, delay, modify_all);
- mutex_unlock(&core_dbs_info->cdbs.shared->timer_mutex);
+
+ if (modify_all)
+ dbs_check_cpu(dbs_data, cdbs->shared->policy->cpu);
+
+ return delay_for_sampling_rate(cs_tuners->sampling_rate);
}
static int dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val,