Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[sfrench/cifs-2.6.git] / arch / i386 / kernel / cpu / cpufreq / speedstep-centrino.c
index 7dcbf70fc16f52afaaf355aa1f4f1c7aae0ca1d5..edb9873e27e37fbb7ee1f66c89c5e87436bec3bd 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/init.h>
 #include <linux/cpufreq.h>
 #include <linux/config.h>
+#include <linux/sched.h>       /* current */
 #include <linux/delay.h>
 #include <linux/compiler.h>
 
@@ -66,7 +67,7 @@ static const struct cpu_id cpu_ids[] = {
        [CPU_MP4HT_D0]  = {15,  3, 4 },
        [CPU_MP4HT_E0]  = {15,  4, 1 },
 };
-#define N_IDS  (sizeof(cpu_ids)/sizeof(cpu_ids[0]))
+#define N_IDS  ARRAY_SIZE(cpu_ids)
 
 struct cpu_model
 {
@@ -259,7 +260,7 @@ static int centrino_cpu_init_table(struct cpufreq_policy *policy)
 
        if (model->op_points == NULL) {
                /* Matched a non-match */
-               dprintk(KERN_INFO PFX "no table support for CPU model \"%s\"\n",
+               dprintk(KERN_INFO PFX "no table support for CPU model \"%s\"\n",
                       cpu->x86_model_id);
 #ifndef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI
                dprintk(KERN_INFO PFX "try compiling with CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI enabled\n");
@@ -375,7 +376,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
        arg0.buffer.pointer = (u8 *) arg0_buf;
        arg0_buf[0] = ACPI_PDC_REVISION_ID;
        arg0_buf[1] = 1;
-       arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP | ACPI_PDC_EST_CAPABILITY_MSR;
+       arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP_MSR;
 
        p.pdc = &arg_list;
 
@@ -402,7 +403,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
 
        for (i=0; i<p.state_count; i++) {
                if (p.states[i].control != p.states[i].status) {
-                       dprintk("Different control (%x) and status values (%x)\n",
+                       dprintk("Different control (%llu) and status values (%llu)\n",
                                p.states[i].control, p.states[i].status);
                        result = -EINVAL;
                        goto err_unreg;
@@ -415,19 +416,18 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
                }
 
                if (p.states[i].core_frequency > p.states[0].core_frequency) {
-                       dprintk("P%u has larger frequency (%u) than P0 (%u), skipping\n", i,
+                       dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i,
                                p.states[i].core_frequency, p.states[0].core_frequency);
                        p.states[i].core_frequency = 0;
                        continue;
                }
        }
 
-       centrino_model[cpu] = kmalloc(sizeof(struct cpu_model), GFP_KERNEL);
+       centrino_model[cpu] = kzalloc(sizeof(struct cpu_model), GFP_KERNEL);
        if (!centrino_model[cpu]) {
                result = -ENOMEM;
                goto err_unreg;
        }
-       memset(centrino_model[cpu], 0, sizeof(struct cpu_model));
 
        centrino_model[cpu]->model_name=NULL;
        centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000;
@@ -498,13 +498,6 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
        if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST))
                return -ENODEV;
 
-       for (i = 0; i < N_IDS; i++)
-               if (centrino_verify_cpu_id(cpu, &cpu_ids[i]))
-                       break;
-
-       if (i != N_IDS)
-               centrino_cpu[policy->cpu] = &cpu_ids[i];
-
        if (is_const_loops_cpu(policy->cpu)) {
                centrino_driver.flags |= CPUFREQ_CONST_LOOPS;
        }
@@ -513,6 +506,13 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
                if (policy->cpu != 0)
                        return -ENODEV;
 
+               for (i = 0; i < N_IDS; i++)
+                       if (centrino_verify_cpu_id(cpu, &cpu_ids[i]))
+                               break;
+
+               if (i != N_IDS)
+                       centrino_cpu[policy->cpu] = &cpu_ids[i];
+
                if (!centrino_cpu[policy->cpu]) {
                        dprintk(KERN_INFO PFX "found unsupported CPU with "
                        "Enhanced SpeedStep: send /proc/cpuinfo to "