cpufreq: conservative: Fix relation when decreasing frequency
[deliverable/linux.git] / drivers / cpufreq / cpufreq_ondemand.c
index 15e80ee61352d97fdf991950282780734c8ab816..459f9ee39c74101fdae9291fed66d121ec41fa23 100644 (file)
@@ -216,7 +216,6 @@ static void od_check_cpu(int cpu, unsigned int load_freq)
 
 static void od_dbs_timer(struct work_struct *work)
 {
-       struct delayed_work *dw = to_delayed_work(work);
        struct od_cpu_dbs_info_s *dbs_info =
                container_of(work, struct od_cpu_dbs_info_s, cdbs.work.work);
        unsigned int cpu = dbs_info->cdbs.cur_policy->cpu;
@@ -224,35 +223,36 @@ static void od_dbs_timer(struct work_struct *work)
                        cpu);
        struct dbs_data *dbs_data = dbs_info->cdbs.cur_policy->governor_data;
        struct od_dbs_tuners *od_tuners = dbs_data->tuners;
-       int delay, sample_type = core_dbs_info->sample_type;
-       bool eval_load;
+       int delay = 0, sample_type = core_dbs_info->sample_type;
+       bool modify_all = true;
 
        mutex_lock(&core_dbs_info->cdbs.timer_mutex);
-       eval_load = need_load_eval(&core_dbs_info->cdbs,
-                       od_tuners->sampling_rate);
+       if (!need_load_eval(&core_dbs_info->cdbs, od_tuners->sampling_rate)) {
+               modify_all = false;
+               goto max_delay;
+       }
 
        /* Common NORMAL_SAMPLE setup */
        core_dbs_info->sample_type = OD_NORMAL_SAMPLE;
        if (sample_type == OD_SUB_SAMPLE) {
                delay = core_dbs_info->freq_lo_jiffies;
-               if (eval_load)
-                       __cpufreq_driver_target(core_dbs_info->cdbs.cur_policy,
-                                               core_dbs_info->freq_lo,
-                                               CPUFREQ_RELATION_H);
+               __cpufreq_driver_target(core_dbs_info->cdbs.cur_policy,
+                               core_dbs_info->freq_lo, CPUFREQ_RELATION_H);
        } else {
-               if (eval_load)
-                       dbs_check_cpu(dbs_data, cpu);
+               dbs_check_cpu(dbs_data, cpu);
                if (core_dbs_info->freq_lo) {
                        /* Setup timer for SUB_SAMPLE */
                        core_dbs_info->sample_type = OD_SUB_SAMPLE;
                        delay = core_dbs_info->freq_hi_jiffies;
-               } else {
-                       delay = delay_for_sampling_rate(od_tuners->sampling_rate
-                                               * core_dbs_info->rate_mult);
                }
        }
 
-       schedule_delayed_work_on(smp_processor_id(), dw, delay);
+max_delay:
+       if (!delay)
+               delay = delay_for_sampling_rate(od_tuners->sampling_rate
+                               * core_dbs_info->rate_mult);
+
+       gov_queue_work(dbs_data, dbs_info->cdbs.cur_policy, delay, modify_all);
        mutex_unlock(&core_dbs_info->cdbs.timer_mutex);
 }
 
@@ -312,8 +312,8 @@ static void update_sampling_rate(struct dbs_data *dbs_data,
                        cancel_delayed_work_sync(&dbs_info->cdbs.work);
                        mutex_lock(&dbs_info->cdbs.timer_mutex);
 
-                       schedule_delayed_work_on(cpu, &dbs_info->cdbs.work,
-                                       usecs_to_jiffies(new_rate));
+                       gov_queue_work(dbs_data, dbs_info->cdbs.cur_policy,
+                                       usecs_to_jiffies(new_rate), true);
 
                }
                mutex_unlock(&dbs_info->cdbs.timer_mutex);
This page took 0.025318 seconds and 5 git commands to generate.