]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/cpufreq/cpufreq.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia
[mv-sheeva.git] / drivers / cpufreq / cpufreq.c
index 8c2df3499da7b11beedf6535e125d1286cf3f17d..7f2f149ae40fd4efa933052aa1caf9e1c3834b45 100644 (file)
@@ -126,6 +126,15 @@ static int __init init_cpufreq_transition_notifier_list(void)
 }
 pure_initcall(init_cpufreq_transition_notifier_list);
 
+static int off __read_mostly;
+int cpufreq_disabled(void)
+{
+       return off;
+}
+void disable_cpufreq(void)
+{
+       off = 1;
+}
 static LIST_HEAD(cpufreq_governor_list);
 static DEFINE_MUTEX(cpufreq_governor_mutex);
 
@@ -204,8 +213,7 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
                pr_debug("saving %lu as reference value for loops_per_jiffy; "
                        "freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq);
        }
-       if ((val == CPUFREQ_PRECHANGE  && ci->old < ci->new) ||
-           (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) ||
+       if ((val == CPUFREQ_POSTCHANGE  && ci->old != ci->new) ||
            (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) {
                loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq,
                                                                ci->new);
@@ -1442,6 +1450,9 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
 {
        int retval = -EINVAL;
 
+       if (cpufreq_disabled())
+               return -ENODEV;
+
        pr_debug("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
                target_freq, relation);
        if (cpu_online(policy->cpu) && cpufreq_driver->target)
@@ -1550,6 +1561,9 @@ int cpufreq_register_governor(struct cpufreq_governor *governor)
        if (!governor)
                return -EINVAL;
 
+       if (cpufreq_disabled())
+               return -ENODEV;
+
        mutex_lock(&cpufreq_governor_mutex);
 
        err = -EBUSY;
@@ -1573,6 +1587,9 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor)
        if (!governor)
                return;
 
+       if (cpufreq_disabled())
+               return;
+
 #ifdef CONFIG_HOTPLUG_CPU
        for_each_present_cpu(cpu) {
                if (cpu_online(cpu))
@@ -1815,6 +1832,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
        unsigned long flags;
        int ret;
 
+       if (cpufreq_disabled())
+               return -ENODEV;
+
        if (!driver_data || !driver_data->verify || !driver_data->init ||
            ((!driver_data->setpolicy) && (!driver_data->target)))
                return -EINVAL;
@@ -1902,6 +1922,9 @@ static int __init cpufreq_core_init(void)
 {
        int cpu;
 
+       if (cpufreq_disabled())
+               return -ENODEV;
+
        for_each_possible_cpu(cpu) {
                per_cpu(cpufreq_policy_cpu, cpu) = -1;
                init_rwsem(&per_cpu(cpu_policy_rwsem, cpu));