[CPUFREQ] hotplug cpu fix for powernow-k8
authorshin, jacob <jacob.shin@amd.com>
Mon, 27 Mar 2006 15:57:20 +0000 (09:57 -0600)
committerDave Jones <davej@redhat.com>
Mon, 27 Mar 2006 20:01:28 +0000 (15:01 -0500)
Andi's previous fix to initialise powernow_data on all siblings
will not work properly with CPU Hotplug.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Signed-off-by: Dave Jones <davej@redhat.com>
arch/i386/kernel/cpu/cpufreq/powernow-k8.c

index 1e70823e1cb583ea8a8ff78c66472169f0cecf96..712a26bd4457901618f81615a8b049eef6a9c93c 100644 (file)
@@ -1095,10 +1095,15 @@ static int __devexit powernowk8_cpu_exit (struct cpufreq_policy *pol)
 
 static unsigned int powernowk8_get (unsigned int cpu)
 {
-       struct powernow_k8_data *data = powernow_data[cpu];
+       struct powernow_k8_data *data;
        cpumask_t oldmask = current->cpus_allowed;
        unsigned int khz = 0;
 
+       data = powernow_data[first_cpu(cpu_core_map[cpu])];
+
+       if (!data)
+               return -EINVAL;
+
        set_cpus_allowed(current, cpumask_of_cpu(cpu));
        if (smp_processor_id() != cpu) {
                printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu);