Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
authorLinus Torvalds <torvalds@g5.osdl.org>
Sat, 25 Mar 2006 16:52:23 +0000 (08:52 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 25 Mar 2006 16:52:23 +0000 (08:52 -0800)
* master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] kzalloc conversion for gx-suspmod
  [CPUFREQ] Whitespace cleanup
  [CPUFREQ] Mark longhaul driver as broken.
  [PATCH] cpufreq: fix section mismatch warnings
  [CPUFREQ] Fix the p4-clockmod N60 errata workaround.
  [CPUFREQ] Fix handling for CPU hotplug
  [CPUFREQ] powernow-k8: Let cpufreq driver handle affected CPUs
  [CPUFREQ] Lots of whitespace & CodingStyle cleanup.
  [CPUFREQ] Remove duplicate cpuinfo struct
  [CPUFREQ] Silence powernow-k8 warning on k7's.

1  2 
arch/i386/kernel/cpu/cpufreq/powernow-k8.c
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c

@@@ -45,7 -45,7 +45,7 @@@
  
  #define PFX "powernow-k8: "
  #define BFX PFX "BIOS error: "
- #define VERSION "version 1.60.0"
+ #define VERSION "version 1.60.1"
  #include "powernow-k8.h"
  
  /* serialize freq changes  */
@@@ -83,11 -83,10 +83,10 @@@ static u32 find_millivolts_from_vid(str
   */
  static u32 convert_fid_to_vco_fid(u32 fid)
  {
-       if (fid < HI_FID_TABLE_BOTTOM) {
+       if (fid < HI_FID_TABLE_BOTTOM)
                return 8 + (2 * fid);
-       } else {
+       else
                return fid;
-       }
  }
  
  /*
@@@ -177,7 -176,7 +176,7 @@@ static int write_new_fid(struct powerno
                if (i++ > 100) {
                        printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n");
                        return 1;
-               }                       
+               }
        } while (query_current_values_with_pending_wait(data));
  
        count_off_irt(data);
@@@ -474,8 -473,10 +473,10 @@@ static int check_supported_cpu(unsigne
                goto out;
  
        eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
+       if ((eax & CPUID_XFAM) != CPUID_XFAM_K8)
+               goto out;
        if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
-           ((eax & CPUID_XFAM) != CPUID_XFAM_K8) ||
            ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) {
                printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax);
                goto out;
@@@ -780,9 -781,7 +781,7 @@@ static int powernow_k8_cpu_init_acpi(st
                /* verify only 1 entry from the lo frequency table */
                if (fid < HI_FID_TABLE_BOTTOM) {
                        if (cntlofreq) {
-                               /* if both entries are the same, ignore this
-                                * one... 
-                                */
+                               /* if both entries are the same, ignore this one ... */
                                if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) ||
                                    (powernow_table[i].index != powernow_table[cntlofreq].index)) {
                                        printk(KERN_ERR PFX "Too many lo freq table entries\n");
@@@ -854,7 -853,7 +853,7 @@@ static int transition_frequency(struct 
        dprintk("cpu %d transition to index %u\n", smp_processor_id(), index);
  
        /* fid are the lower 8 bits of the index we stored into
-        * the cpufreq frequency table in find_psb_table, vid are 
+        * the cpufreq frequency table in find_psb_table, vid are
         * the upper 8 bits.
         */
  
@@@ -909,7 -908,6 +908,6 @@@ static int powernowk8_target(struct cpu
        u32 checkvid = data->currvid;
        unsigned int newstate;
        int ret = -EIO;
-       int i;
  
        /* only run on specific CPU from here on */
        oldmask = current->cpus_allowed;
                up(&fidvid_sem);
                goto err_out;
        }
-       /* Update all the fid/vids of our siblings */
-       for_each_cpu_mask(i, cpu_core_map[pol->cpu]) {
-               powernow_data[i]->currvid = data->currvid;
-               powernow_data[i]->currfid = data->currfid;
-       }       
        up(&fidvid_sem);
  
        pol->cur = find_khz_freq_from_fid(data->currfid);
@@@ -984,7 -976,7 +976,7 @@@ static int __cpuinit powernowk8_cpu_ini
  {
        struct powernow_k8_data *data;
        cpumask_t oldmask = CPU_MASK_ALL;
-       int rc, i;
+       int rc;
  
        if (!cpu_online(pol->cpu))
                return -ENODEV;
        pol->governor = CPUFREQ_DEFAULT_GOVERNOR;
        pol->cpus = cpu_core_map[pol->cpu];
  
-       /* Take a crude guess here. 
+       /* Take a crude guess here.
         * That guess was in microseconds, so multiply with 1000 */
        pol->cpuinfo.transition_latency = (((data->rvo + 8) * data->vstable * VST_UNITS_20US)
            + (3 * (1 << data->irt) * 10)) * 1000;
        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;
  
@@@ -1145,14 -1135,16 +1135,14 @@@ static int __cpuinit powernowk8_init(vo
  {
        unsigned int i, supported_cpus = 0;
  
 -      for (i=0; i<NR_CPUS; i++) {
 -              if (!cpu_online(i))
 -                      continue;
 +      for_each_online_cpu(i) {
                if (check_supported_cpu(i))
                        supported_cpus++;
        }
  
        if (supported_cpus == num_online_cpus()) {
 -              printk(KERN_INFO PFX "Found %d AMD Athlon 64 / Opteron processors (" VERSION ")\n",
 -                      supported_cpus);
 +              printk(KERN_INFO PFX "Found %d AMD Athlon 64 / Opteron "
 +                      "processors (" VERSION ")\n", supported_cpus);
                return cpufreq_register_driver(&cpufreq_amd64_driver);
        }
  
@@@ -13,8 -13,8 +13,8 @@@
   *********************************************************************/
  
  #include <linux/kernel.h>
- #include <linux/module.h> 
- #include <linux/moduleparam.h> 
+ #include <linux/module.h>
+ #include <linux/moduleparam.h>
  #include <linux/init.h>
  #include <linux/cpufreq.h>
  #include <linux/pci.h>
   *
   * These parameters are got from IST-SMI BIOS call.
   * If user gives it, these are used.
-  * 
+  *
   */
- static int            smi_port        = 0;
- static int            smi_cmd         = 0;
- static unsigned int   smi_sig         = 0;
+ static int smi_port = 0;
+ static int smi_cmd = 0;
+ static unsigned int smi_sig = 0;
  
  /* info about the processor */
- static unsigned int   speedstep_processor = 0;
+ static unsigned int speedstep_processor = 0;
  
- /* 
-  *   There are only two frequency states for each processor. Values
+ /*
+  * There are only two frequency states for each processor. Values
   * are in kHz for the time being.
   */
  static struct cpufreq_frequency_table speedstep_freqs[] = {
-       {SPEEDSTEP_HIGH,        0},
+       {SPEEDSTEP_HIGH,        0},
        {SPEEDSTEP_LOW,         0},
        {0,                     CPUFREQ_TABLE_END},
  };
@@@ -75,9 -75,7 +75,9 @@@ static int speedstep_smi_ownership (voi
        __asm__ __volatile__(
                "out %%al, (%%dx)\n"
                : "=D" (result)
 -              : "a" (command), "b" (function), "c" (0), "d" (smi_port), "D" (0), "S" (magic)
 +              : "a" (command), "b" (function), "c" (0), "d" (smi_port),
 +                      "D" (0), "S" (magic)
 +              : "memory"
        );
  
        dprintk("result is %x\n", result);
@@@ -125,7 -123,7 +125,7 @@@ static int speedstep_smi_get_freqs (uns
        *low  = low_mhz  * 1000;
  
        return result;
- } 
+ }
  
  /**
   * speedstep_get_state - set the SpeedStep state
@@@ -206,7 -204,7 +206,7 @@@ static void speedstep_set_state (unsign
   * speedstep_target - set a new CPUFreq policy
   * @policy: new policy
   * @target_freq: new freq
-  * @relation: 
+  * @relation:
   *
   * Sets a new CPUFreq policy/freq.
   */
@@@ -285,7 -283,7 +285,7 @@@ static int speedstep_cpu_init(struct cp
        state = speedstep_get_state();
        speed = speedstep_freqs[state].frequency;
  
-       dprintk("currently at %s speed setting - %i MHz\n", 
+       dprintk("currently at %s speed setting - %i MHz\n",
                (speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high",
                (speed / 1000));
  
        if (result)
                return (result);
  
-         cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu);
+       cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu);
  
        return 0;
  }
@@@ -334,8 -332,8 +334,8 @@@ static struct freq_attr* speedstep_attr
  
  static struct cpufreq_driver speedstep_driver = {
        .name           = "speedstep-smi",
-       .verify         = speedstep_verify,
-       .target         = speedstep_target,
+       .verify         = speedstep_verify,
+       .target         = speedstep_target,
        .init           = speedstep_cpu_init,
        .exit           = speedstep_cpu_exit,
        .get            = speedstep_get,
@@@ -372,13 -370,12 +372,12 @@@ static int __init speedstep_init(void
                return -ENODEV;
        }
  
-       dprintk("signature:0x%.8lx, command:0x%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n", 
+       dprintk("signature:0x%.8lx, command:0x%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n",
                ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level);
  
-       /* Error if no IST-SMI BIOS or no PARM 
+       /* Error if no IST-SMI BIOS or no PARM
                 sig= 'ISGE' aka 'Intel Speedstep Gate E' */
-       if ((ist_info.signature !=  0x47534943) && ( 
+       if ((ist_info.signature !=  0x47534943) && (
            (smi_port == 0) || (smi_cmd == 0)))
                return -ENODEV;
  
                smi_sig = ist_info.signature;
  
        /* setup smi_port from MODLULE_PARM or BIOS */
-       if ((smi_port > 0xff) || (smi_port < 0)) {
+       if ((smi_port > 0xff) || (smi_port < 0))
                return -EINVAL;
-       } else if (smi_port == 0) {
+       else if (smi_port == 0)
                smi_port = ist_info.command & 0xff;
-       }
  
-       if ((smi_cmd > 0xff) || (smi_cmd < 0)) {
+       if ((smi_cmd > 0xff) || (smi_cmd < 0))
                return -EINVAL;
-       } else if (smi_cmd == 0) {
+       else if (smi_cmd == 0)
                smi_cmd = (ist_info.command >> 16) & 0xff;
-       }
  
        return cpufreq_register_driver(&speedstep_driver);
  }