aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq_governor.c
diff options
context:
space:
mode:
authorFabio Baltieri <fabio.baltieri@linaro.org>2013-01-30 08:53:37 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-02-01 18:01:16 -0500
commit58ddcead4f163a01cef96aa5ba88f374011d8aea (patch)
treee77861e11a8b1fe69171f9c2f0bdc3506b2d045b /drivers/cpufreq/cpufreq_governor.c
parentfcf8058296edbc3de43adf095824fc32b067b9f8 (diff)
cpufreq: governors: clean timer init and exit code
Drop unused arguments from dbs_timer_init and clean dbs_timer_exit and cpufreq_governor_dbs to remove non necessary special cases. Reported-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@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.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index ee8b7cac11f3..46f96a4cebf9 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -169,19 +169,19 @@ bool dbs_sw_coordinated_cpus(struct cpu_dbs_common_info *cdbs)
169} 169}
170EXPORT_SYMBOL_GPL(dbs_sw_coordinated_cpus); 170EXPORT_SYMBOL_GPL(dbs_sw_coordinated_cpus);
171 171
172static inline void dbs_timer_init(struct dbs_data *dbs_data, 172static inline void dbs_timer_init(struct dbs_data *dbs_data, int cpu,
173 struct cpu_dbs_common_info *cdbs, 173 unsigned int sampling_rate)
174 unsigned int sampling_rate,
175 int cpu)
176{ 174{
177 int delay = delay_for_sampling_rate(sampling_rate); 175 int delay = delay_for_sampling_rate(sampling_rate);
178 struct cpu_dbs_common_info *cdbs_local = dbs_data->get_cpu_cdbs(cpu); 176 struct cpu_dbs_common_info *cdbs = dbs_data->get_cpu_cdbs(cpu);
179 177
180 schedule_delayed_work_on(cpu, &cdbs_local->work, delay); 178 schedule_delayed_work_on(cpu, &cdbs->work, delay);
181} 179}
182 180
183static inline void dbs_timer_exit(struct cpu_dbs_common_info *cdbs) 181static inline void dbs_timer_exit(struct dbs_data *dbs_data, int cpu)
184{ 182{
183 struct cpu_dbs_common_info *cdbs = dbs_data->get_cpu_cdbs(cpu);
184
185 cancel_delayed_work_sync(&cdbs->work); 185 cancel_delayed_work_sync(&cdbs->work);
186} 186}
187 187
@@ -289,36 +289,19 @@ second_time:
289 } 289 }
290 mutex_unlock(&dbs_data->mutex); 290 mutex_unlock(&dbs_data->mutex);
291 291
292 if (dbs_sw_coordinated_cpus(cpu_cdbs)) { 292 /* Initiate timer time stamp */
293 /* Initiate timer time stamp */ 293 cpu_cdbs->time_stamp = ktime_get();
294 cpu_cdbs->time_stamp = ktime_get();
295 294
296 for_each_cpu(j, policy->cpus) { 295 for_each_cpu(j, policy->cpus)
297 struct cpu_dbs_common_info *j_cdbs; 296 dbs_timer_init(dbs_data, j, *sampling_rate);
298
299 j_cdbs = dbs_data->get_cpu_cdbs(j);
300 dbs_timer_init(dbs_data, j_cdbs,
301 *sampling_rate, j);
302 }
303 } else {
304 dbs_timer_init(dbs_data, cpu_cdbs, *sampling_rate, cpu);
305 }
306 break; 297 break;
307 298
308 case CPUFREQ_GOV_STOP: 299 case CPUFREQ_GOV_STOP:
309 if (dbs_data->governor == GOV_CONSERVATIVE) 300 if (dbs_data->governor == GOV_CONSERVATIVE)
310 cs_dbs_info->enable = 0; 301 cs_dbs_info->enable = 0;
311 302
312 if (dbs_sw_coordinated_cpus(cpu_cdbs)) { 303 for_each_cpu(j, policy->cpus)
313 for_each_cpu(j, policy->cpus) { 304 dbs_timer_exit(dbs_data, j);
314 struct cpu_dbs_common_info *j_cdbs;
315
316 j_cdbs = dbs_data->get_cpu_cdbs(j);
317 dbs_timer_exit(j_cdbs);
318 }
319 } else {
320 dbs_timer_exit(cpu_cdbs);
321 }
322 305
323 mutex_lock(&dbs_data->mutex); 306 mutex_lock(&dbs_data->mutex);
324 mutex_destroy(&cpu_cdbs->timer_mutex); 307 mutex_destroy(&cpu_cdbs->timer_mutex);