]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/cpufreq/loongson2_cpufreq.c
cpufreq: Implement light weight ->target_index() routine
[mirror_ubuntu-artful-kernel.git] / drivers / cpufreq / loongson2_cpufreq.c
index 2c8ec8e064490be7d56b4e591960b2e11a4bf813..41a8e2cdf9405a5d90c483ac330f8cd68530d7be 100644 (file)
@@ -53,11 +53,9 @@ static unsigned int loongson2_cpufreq_get(unsigned int cpu)
  * Here we notify other drivers of the proposed change and the final change.
  */
 static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
-                                    unsigned int target_freq,
-                                    unsigned int relation)
+                                    unsigned int index)
 {
        unsigned int cpu = policy->cpu;
-       unsigned int newstate = 0;
        cpumask_t cpus_allowed;
        struct cpufreq_freqs freqs;
        unsigned int freq;
@@ -65,26 +63,17 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
        cpus_allowed = current->cpus_allowed;
        set_cpus_allowed_ptr(current, cpumask_of(cpu));
 
-       if (cpufreq_frequency_table_target
-           (policy, &loongson2_clockmod_table[0], target_freq, relation,
-            &newstate))
-               return -EINVAL;
-
        freq =
            ((cpu_clock_freq / 1000) *
-            loongson2_clockmod_table[newstate].driver_data) / 8;
-       if (freq < policy->min || freq > policy->max)
-               return -EINVAL;
+            loongson2_clockmod_table[index].driver_data) / 8;
 
-       pr_debug("cpufreq: requested frequency %u Hz\n", target_freq * 1000);
+       pr_debug("cpufreq: requested frequency %u Hz\n",
+                       loongson2_clockmod_table[index].frequency * 1000);
 
        freqs.old = loongson2_cpufreq_get(cpu);
        freqs.new = freq;
        freqs.flags = 0;
 
-       if (freqs.new == freqs.old)
-               return 0;
-
        /* notifiers */
        cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
 
@@ -145,7 +134,7 @@ static struct cpufreq_driver loongson2_cpufreq_driver = {
        .name = "loongson2",
        .init = loongson2_cpufreq_cpu_init,
        .verify = cpufreq_generic_frequency_table_verify,
-       .target = loongson2_cpufreq_target,
+       .target_index = loongson2_cpufreq_target,
        .get = loongson2_cpufreq_get,
        .exit = loongson2_cpufreq_exit,
        .attr = cpufreq_generic_attr,