Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[pandora-kernel.git] / arch / x86 / kernel / cpu / cpufreq / powernow-k8.c
index c99d59d..53c7b69 100644 (file)
@@ -478,12 +478,13 @@ static int core_voltage_post_transition(struct powernow_k8_data *data, u32 reqvi
 
 static int check_supported_cpu(unsigned int cpu)
 {
-       cpumask_t oldmask = CPU_MASK_ALL;
+       cpumask_t oldmask;
+       cpumask_of_cpu_ptr(cpu_mask, cpu);
        u32 eax, ebx, ecx, edx;
        unsigned int rc = 0;
 
        oldmask = current->cpus_allowed;
-       set_cpus_allowed(current, cpumask_of_cpu(cpu));
+       set_cpus_allowed_ptr(current, cpu_mask);
 
        if (smp_processor_id() != cpu) {
                printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu);
@@ -528,7 +529,7 @@ static int check_supported_cpu(unsigned int cpu)
        rc = 1;
 
 out:
-       set_cpus_allowed(current, oldmask);
+       set_cpus_allowed_ptr(current, &oldmask);
        return rc;
 }
 
@@ -966,7 +967,7 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned i
        freqs.old = find_khz_freq_from_fid(data->currfid);
        freqs.new = find_khz_freq_from_fid(fid);
 
-       for_each_cpu_mask(i, *(data->available_cores)) {
+       for_each_cpu_mask_nr(i, *(data->available_cores)) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
        }
@@ -974,7 +975,7 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned i
        res = transition_fid_vid(data, fid, vid);
        freqs.new = find_khz_freq_from_fid(data->currfid);
 
-       for_each_cpu_mask(i, *(data->available_cores)) {
+       for_each_cpu_mask_nr(i, *(data->available_cores)) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
        }
@@ -997,7 +998,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
        freqs.old = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
        freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
 
-       for_each_cpu_mask(i, *(data->available_cores)) {
+       for_each_cpu_mask_nr(i, *(data->available_cores)) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
        }
@@ -1005,7 +1006,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
        res = transition_pstate(data, pstate);
        freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
 
-       for_each_cpu_mask(i, *(data->available_cores)) {
+       for_each_cpu_mask_nr(i, *(data->available_cores)) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
        }
@@ -1015,7 +1016,8 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
 /* Driver entry point to switch to the target frequency */
 static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation)
 {
-       cpumask_t oldmask = CPU_MASK_ALL;
+       cpumask_t oldmask;
+       cpumask_of_cpu_ptr(cpu_mask, pol->cpu);
        struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
        u32 checkfid;
        u32 checkvid;
@@ -1030,7 +1032,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
 
        /* only run on specific CPU from here on */
        oldmask = current->cpus_allowed;
-       set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
+       set_cpus_allowed_ptr(current, cpu_mask);
 
        if (smp_processor_id() != pol->cpu) {
                printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
@@ -1085,7 +1087,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
        ret = 0;
 
 err_out:
-       set_cpus_allowed(current, oldmask);
+       set_cpus_allowed_ptr(current, &oldmask);
        return ret;
 }
 
@@ -1104,7 +1106,8 @@ static int powernowk8_verify(struct cpufreq_policy *pol)
 static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
 {
        struct powernow_k8_data *data;
-       cpumask_t oldmask = CPU_MASK_ALL;
+       cpumask_t oldmask;
+       cpumask_of_cpu_ptr_declare(newmask);
        int rc;
 
        if (!cpu_online(pol->cpu))
@@ -1127,12 +1130,23 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
                 * an UP version, and is deprecated by AMD.
                 */
                if (num_online_cpus() != 1) {
-                       printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n");
+#ifndef CONFIG_ACPI_PROCESSOR
+                       printk(KERN_ERR PFX "ACPI Processor support is required "
+                              "for SMP systems but is absent. Please load the "
+                              "ACPI Processor module before starting this "
+                              "driver.\n");
+#else
+                       printk(KERN_ERR PFX "Your BIOS does not provide ACPI "
+                              "_PSS objects in a way that Linux understands. "
+                              "Please report this to the Linux ACPI maintainers"
+                              " and complain to your BIOS vendor.\n");
+#endif
                        kfree(data);
                        return -ENODEV;
                }
                if (pol->cpu != 0) {
-                       printk(KERN_ERR PFX "No _PSS objects for CPU other than CPU0\n");
+                       printk(KERN_ERR PFX "No ACPI _PSS objects for CPU other than "
+                              "CPU0. Complain to your BIOS vendor.\n");
                        kfree(data);
                        return -ENODEV;
                }
@@ -1145,7 +1159,8 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
 
        /* only run on specific CPU from here on */
        oldmask = current->cpus_allowed;
-       set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
+       cpumask_of_cpu_ptr_next(newmask, pol->cpu);
+       set_cpus_allowed_ptr(current, newmask);
 
        if (smp_processor_id() != pol->cpu) {
                printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
@@ -1164,10 +1179,10 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
                fidvid_msr_init();
 
        /* run on any CPU again */
-       set_cpus_allowed(current, oldmask);
+       set_cpus_allowed_ptr(current, &oldmask);
 
        if (cpu_family == CPU_HW_PSTATE)
-               pol->cpus = cpumask_of_cpu(pol->cpu);
+               pol->cpus = *newmask;
        else
                pol->cpus = per_cpu(cpu_core_map, pol->cpu);
        data->available_cores = &(pol->cpus);
@@ -1205,7 +1220,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
        return 0;
 
 err_out:
-       set_cpus_allowed(current, oldmask);
+       set_cpus_allowed_ptr(current, &oldmask);
        powernow_k8_cpu_exit_acpi(data);
 
        kfree(data);
@@ -1233,6 +1248,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
 {
        struct powernow_k8_data *data;
        cpumask_t oldmask = current->cpus_allowed;
+       cpumask_of_cpu_ptr(newmask, cpu);
        unsigned int khz = 0;
        unsigned int first;
 
@@ -1242,10 +1258,11 @@ static unsigned int powernowk8_get (unsigned int cpu)
        if (!data)
                return -EINVAL;
 
-       set_cpus_allowed(current, cpumask_of_cpu(cpu));
+       set_cpus_allowed_ptr(current, newmask);
        if (smp_processor_id() != cpu) {
-               printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu);
-               set_cpus_allowed(current, oldmask);
+               printk(KERN_ERR PFX
+                       "limiting to CPU %d failed in powernowk8_get\n", cpu);
+               set_cpus_allowed_ptr(current, &oldmask);
                return 0;
        }
 
@@ -1253,13 +1270,14 @@ static unsigned int powernowk8_get (unsigned int cpu)
                goto out;
 
        if (cpu_family == CPU_HW_PSTATE)
-               khz = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
+               khz = find_khz_freq_from_pstate(data->powernow_table,
+                                               data->currpstate);
        else
                khz = find_khz_freq_from_fid(data->currfid);
 
 
 out:
-       set_cpus_allowed(current, oldmask);
+       set_cpus_allowed_ptr(current, &oldmask);
        return khz;
 }