[CPUFREQ] CPU frequency display in /proc/cpuinfo
[powerpc.git] / drivers / cpufreq / cpufreq.c
index 1c0f62d..a9163d0 100644 (file)
@@ -822,6 +822,30 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne
 }
 
 
+/** 
+ * cpufreq_quick_get - get the CPU frequency (in kHz) frpm policy->cur
+ * @cpu: CPU number
+ *
+ * This is the last known freq, without actually getting it from the driver.
+ * Return value will be same as what is shown in scaling_cur_freq in sysfs.
+ */
+unsigned int cpufreq_quick_get(unsigned int cpu)
+{
+       struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
+       unsigned int ret = 0;
+
+       if (policy) {
+               down(&policy->lock);
+               ret = policy->cur;
+               up(&policy->lock);
+               cpufreq_cpu_put(policy);
+       }
+
+       return (ret);
+}
+EXPORT_SYMBOL(cpufreq_quick_get);
+
+
 /** 
  * cpufreq_get - get the current CPU frequency (in kHz)
  * @cpu: CPU number
@@ -1113,21 +1137,13 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
 {
        int retval = -EINVAL;
 
-       /*
-        * If we are already in context of hotplug thread, we dont need to
-        * acquire the hotplug lock. Otherwise acquire cpucontrol to prevent
-        * hotplug from removing this cpu that we are working on.
-        */
-       if (!current_in_cpu_hotplug())
-               lock_cpu_hotplug();
-
+       lock_cpu_hotplug();
        dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu,
                target_freq, relation);
        if (cpu_online(policy->cpu) && cpufreq_driver->target)
                retval = cpufreq_driver->target(policy, target_freq, relation);
 
-       if (!current_in_cpu_hotplug())
-               unlock_cpu_hotplug();
+       unlock_cpu_hotplug();
 
        return retval;
 }