diff options
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 8d83a21c6477..0bc0bff55d26 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -57,7 +57,6 @@ static unsigned int def_sampling_rate; | |||
57 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) | 57 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
58 | #define DEF_SAMPLING_DOWN_FACTOR (10) | 58 | #define DEF_SAMPLING_DOWN_FACTOR (10) |
59 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) | 59 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) |
60 | #define sampling_rate_in_HZ(x) (((x * HZ) < (1000 * 1000))?1:((x * HZ) / (1000 * 1000))) | ||
61 | 60 | ||
62 | static void do_dbs_timer(void *data); | 61 | static void do_dbs_timer(void *data); |
63 | 62 | ||
@@ -281,7 +280,7 @@ static void dbs_check_cpu(int cpu) | |||
281 | /* Scale idle ticks by 100 and compare with up and down ticks */ | 280 | /* Scale idle ticks by 100 and compare with up and down ticks */ |
282 | idle_ticks *= 100; | 281 | idle_ticks *= 100; |
283 | up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) * | 282 | up_idle_ticks = (100 - dbs_tuners_ins.up_threshold) * |
284 | sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate); | 283 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
285 | 284 | ||
286 | if (idle_ticks < up_idle_ticks) { | 285 | if (idle_ticks < up_idle_ticks) { |
287 | __cpufreq_driver_target(policy, policy->max, | 286 | __cpufreq_driver_target(policy, policy->max, |
@@ -328,7 +327,7 @@ static void dbs_check_cpu(int cpu) | |||
328 | freq_down_sampling_rate = dbs_tuners_ins.sampling_rate * | 327 | freq_down_sampling_rate = dbs_tuners_ins.sampling_rate * |
329 | dbs_tuners_ins.sampling_down_factor; | 328 | dbs_tuners_ins.sampling_down_factor; |
330 | down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) * | 329 | down_idle_ticks = (100 - dbs_tuners_ins.down_threshold) * |
331 | sampling_rate_in_HZ(freq_down_sampling_rate); | 330 | usecs_to_jiffies(freq_down_sampling_rate); |
332 | 331 | ||
333 | if (idle_ticks > down_idle_ticks ) { | 332 | if (idle_ticks > down_idle_ticks ) { |
334 | freq_down_step = (5 * policy->max) / 100; | 333 | freq_down_step = (5 * policy->max) / 100; |
@@ -348,11 +347,10 @@ static void do_dbs_timer(void *data) | |||
348 | { | 347 | { |
349 | int i; | 348 | int i; |
350 | down(&dbs_sem); | 349 | down(&dbs_sem); |
351 | for (i = 0; i < NR_CPUS; i++) | 350 | for_each_online_cpu(i) |
352 | if (cpu_online(i)) | 351 | dbs_check_cpu(i); |
353 | dbs_check_cpu(i); | ||
354 | schedule_delayed_work(&dbs_work, | 352 | schedule_delayed_work(&dbs_work, |
355 | sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate)); | 353 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
356 | up(&dbs_sem); | 354 | up(&dbs_sem); |
357 | } | 355 | } |
358 | 356 | ||
@@ -360,7 +358,7 @@ static inline void dbs_timer_init(void) | |||
360 | { | 358 | { |
361 | INIT_WORK(&dbs_work, do_dbs_timer, NULL); | 359 | INIT_WORK(&dbs_work, do_dbs_timer, NULL); |
362 | schedule_delayed_work(&dbs_work, | 360 | schedule_delayed_work(&dbs_work, |
363 | sampling_rate_in_HZ(dbs_tuners_ins.sampling_rate)); | 361 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
364 | return; | 362 | return; |
365 | } | 363 | } |
366 | 364 | ||