cpufreq: Reuse new freq-table helpers
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 27 Jun 2016 04:29:34 +0000 (09:59 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 6 Jul 2016 22:14:27 +0000 (00:14 +0200)
This patch migrates few users of cpufreq tables to the new helpers
that work on sorted freq-tables.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/acpi-cpufreq.c
drivers/cpufreq/amd_freq_sensitivity.c
drivers/cpufreq/cpufreq_ondemand.c
drivers/cpufreq/powernv-cpufreq.c
drivers/cpufreq/s5pv210-cpufreq.c

index 32a15052f363f886f0dbd2acc58a8bd48cc5286f..11c9a078e0fdd166aa3fa44fc4887176e624c03a 100644 (file)
@@ -468,20 +468,14 @@ unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy,
        struct acpi_cpufreq_data *data = policy->driver_data;
        struct acpi_processor_performance *perf;
        struct cpufreq_frequency_table *entry;
-       unsigned int next_perf_state, next_freq, freq;
+       unsigned int next_perf_state, next_freq, index;
 
        /*
         * Find the closest frequency above target_freq.
-        *
-        * The table is sorted in the reverse order with respect to the
-        * frequency and all of the entries are valid (see the initialization).
         */
-       entry = policy->freq_table;
-       do {
-               entry++;
-               freq = entry->frequency;
-       } while (freq >= target_freq && freq != CPUFREQ_TABLE_END);
-       entry--;
+       index = cpufreq_table_find_index_dl(policy, target_freq);
+
+       entry = &policy->freq_table[index];
        next_freq = entry->frequency;
        next_perf_state = entry->driver_data;
 
index 6d5dc04c3a3762b665cc549dc0c974edffc931da..042023bbbf6214744070196ab5616abc58e81689 100644 (file)
@@ -91,8 +91,8 @@ static unsigned int amd_powersave_bias_target(struct cpufreq_policy *policy,
                else {
                        unsigned int index;
 
-                       index = cpufreq_frequency_table_target(policy,
-                               policy->cur - 1, CPUFREQ_RELATION_H);
+                       index = cpufreq_table_find_index_h(policy,
+                                                          policy->cur - 1);
                        freq_next = policy->freq_table[index].frequency;
                }
 
index 0c93cd9dee996f28fa5b080f2a89cb5ad2a6add3..3a1f49f5f4c68ae4d360e686773cafc2d49b8745 100644 (file)
@@ -85,11 +85,9 @@ static unsigned int generic_powersave_bias_target(struct cpufreq_policy *policy,
        freq_avg = freq_req - freq_reduc;
 
        /* Find freq bounds for freq_avg in freq_table */
-       index = cpufreq_frequency_table_target(policy, freq_avg,
-                                              CPUFREQ_RELATION_H);
+       index = cpufreq_table_find_index_h(policy, freq_avg);
        freq_lo = freq_table[index].frequency;
-       index = cpufreq_frequency_table_target(policy, freq_avg,
-                                              CPUFREQ_RELATION_L);
+       index = cpufreq_table_find_index_l(policy, freq_avg);
        freq_hi = freq_table[index].frequency;
 
        /* Find out how long we have to be in hi and lo freqs */
index b29c5c20c3a1c5fcd60ce05b4cadc6198f7c480b..2a2920c4fdf9ca82970a6b4c3dd6f043b362d9b1 100644 (file)
@@ -760,8 +760,7 @@ void powernv_cpufreq_work_fn(struct work_struct *work)
                struct cpufreq_policy policy;
 
                cpufreq_get_policy(&policy, cpu);
-               index = cpufreq_frequency_table_target(&policy, policy.cur,
-                                              CPUFREQ_RELATION_C);
+               index = cpufreq_table_find_index_c(&policy, policy.cur);
                powernv_cpufreq_target_index(&policy, index);
                cpumask_andnot(&mask, &mask, policy.cpus);
        }
index 4f4e9df9b7fc992dc92836365afe96bec38e8e91..9e07588ea9f5800a246be7cfe9b4cc912480305f 100644 (file)
@@ -246,8 +246,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
        new_freq = s5pv210_freq_table[index].frequency;
 
        /* Finding current running level index */
-       priv_index = cpufreq_frequency_table_target(policy, old_freq,
-                                                   CPUFREQ_RELATION_H);
+       priv_index = cpufreq_table_find_index_h(policy, old_freq);
 
        arm_volt = dvs_conf[index].arm_volt;
        int_volt = dvs_conf[index].int_volt;