[CPUFREQ] Remove pointless reinitialisation from powernow-k8
[linux-drm-fsl-dcu.git] / arch / i386 / kernel / cpu / cpufreq / powernow-k8.c
index 712a26bd4457901618f81615a8b049eef6a9c93c..517de6cb0d0a711066d22d632e3106286d652ff8 100644 (file)
@@ -20,7 +20,7 @@
  *  of the "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD
  *  Opteron Processors" available for download from www.amd.com
  *
- *  Tables for specific CPUs can be infrerred from
+ *  Tables for specific CPUs can be inferred from
  *     http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/30430.pdf
  */
 
@@ -46,7 +46,7 @@
 
 #define PFX "powernow-k8: "
 #define BFX PFX "BIOS error: "
-#define VERSION "version 1.60.1"
+#define VERSION "version 1.60.2"
 #include "powernow-k8.h"
 
 /* serialize freq changes  */
@@ -55,7 +55,7 @@ static DEFINE_MUTEX(fidvid_mutex);
 static struct powernow_k8_data *powernow_data[NR_CPUS];
 
 #ifndef CONFIG_SMP
-static cpumask_t cpu_core_map[1] = { CPU_MASK_ALL };
+static cpumask_t cpu_core_map[1];
 #endif
 
 /* Return a frequency in MHz, given an input fid */
@@ -896,7 +896,7 @@ static int transition_frequency(struct powernow_k8_data *data, unsigned int inde
        for_each_cpu_mask(i, cpu_core_map[data->cpu]) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
-        }
+       }
        return res;
 }
 
@@ -905,11 +905,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
 {
        cpumask_t oldmask = CPU_MASK_ALL;
        struct powernow_k8_data *data = powernow_data[pol->cpu];
-       u32 checkfid = data->currfid;
-       u32 checkvid = data->currvid;
+       u32 checkfid;
+       u32 checkvid;
        unsigned int newstate;
        int ret = -EIO;
 
+       if (!data)
+               return -EINVAL;
+
+       checkfid = data->currfid;
+       checkvid = data->currvid;
+
        /* only run on specific CPU from here on */
        oldmask = current->cpus_allowed;
        set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
@@ -927,10 +933,8 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
        dprintk("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n",
                pol->cpu, targfreq, pol->min, pol->max, relation);
 
-       if (query_current_values_with_pending_wait(data)) {
-               ret = -EIO;
+       if (query_current_values_with_pending_wait(data))
                goto err_out;
-       }
 
        dprintk("targ: curr fid 0x%x, vid 0x%x\n",
                data->currfid, data->currvid);
@@ -969,6 +973,9 @@ static int powernowk8_verify(struct cpufreq_policy *pol)
 {
        struct powernow_k8_data *data = powernow_data[pol->cpu];
 
+       if (!data)
+               return -EINVAL;
+
        return cpufreq_frequency_table_verify(pol, data->powernow_table);
 }
 
@@ -977,7 +984,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
 {
        struct powernow_k8_data *data;
        cpumask_t oldmask = CPU_MASK_ALL;
-       int rc, i;
+       int rc;
 
        if (!cpu_online(pol->cpu))
                return -ENODEV;
@@ -1063,8 +1070,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
        printk("cpu_init done, current fid 0x%x, vid 0x%x\n",
               data->currfid, data->currvid);
 
-       for_each_cpu_mask(i, cpu_core_map[pol->cpu])
-               powernow_data[i] = data;
+       powernow_data[pol->cpu] = data;
 
        return 0;