fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / powerpc / platforms / powermac / cpufreq_32.c
index 56fd4e0..c2b6b41 100644 (file)
@@ -1,6 +1,4 @@
 /*
- *  arch/ppc/platforms/pmac_cpufreq.c
- *
  *  Copyright (C) 2002 - 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
  *  Copyright (C) 2004        John Steele Scott <toojays@toojays.net>
  *
@@ -15,7 +13,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/errno.h>
@@ -70,7 +67,7 @@ static unsigned int cur_freq;
 static unsigned int sleep_freq;
 
 /*
- * Different models uses different mecanisms to switch the frequency
+ * Different models uses different mechanisms to switch the frequency
  */
 static int (*set_speed_proc)(int low_speed);
 static unsigned int (*get_speed_proc)(void);
@@ -270,7 +267,7 @@ static int pmu_set_cpu_speed(int low_speed)
 
        /* Make sure the decrementer won't interrupt us */
        asm volatile("mtdec %0" : : "r" (0x7fffffff));
-       /* Make sure any pending DEC interrupt occuring while we did
+       /* Make sure any pending DEC interrupt occurring while we did
         * the above didn't re-enable the DEC */
        mb();
        asm volatile("mtdec %0" : : "r" (0x7fffffff));
@@ -316,7 +313,7 @@ static int pmu_set_cpu_speed(int low_speed)
                _set_L3CR(save_l3cr);
 
        /* Restore userland MMU context */
-       set_context(current->active_mm->context, current->active_mm->pgd);
+       set_context(current->active_mm->context.id, current->active_mm->pgd);
 
 #ifdef DEBUG_FREQ
        printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
@@ -424,7 +421,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
 static u32 read_gpio(struct device_node *np)
 {
-       u32 *reg = (u32 *)get_property(np, "reg", NULL);
+       const u32 *reg = get_property(np, "reg", NULL);
        u32 offset;
 
        if (reg == NULL)
@@ -500,7 +497,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
                                                                "frequency-gpio");
        struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL,
                                                                     "slewing-done");
-       u32 *value;
+       const u32 *value;
 
        /*
         * Check to see if it's GPIO driven or PMU only
@@ -522,15 +519,15 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
         */
        if (frequency_gpio && slew_done_gpio) {
                int lenp, rc;
-               u32 *freqs, *ratio;
+               const u32 *freqs, *ratio;
 
-               freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp);
+               freqs = get_property(cpunode, "bus-frequencies", &lenp);
                lenp /= sizeof(u32);
                if (freqs == NULL || lenp != 2) {
                        printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n");
                        return 1;
                }
-               ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL);
+               ratio = get_property(cpunode, "processor-to-bus-ratio*2", NULL);
                if (ratio == NULL) {
                        printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n");
                        return 1;
@@ -565,7 +562,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
        /* If we use the PMU, look for the min & max frequencies in the
         * device-tree
         */
-       value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL);
+       value = get_property(cpunode, "min-clock-frequency", NULL);
        if (!value)
                return 1;
        low_freq = (*value) / 1000;
@@ -574,7 +571,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
        if (low_freq < 100000)
                low_freq *= 10;
 
-       value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL);
+       value = get_property(cpunode, "max-clock-frequency", NULL);
        if (!value)
                return 1;
        hi_freq = (*value) / 1000;
@@ -614,13 +611,14 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode)
 static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
 {
        struct device_node *volt_gpio_np;
-       u32 pvr, *value;
+       u32 pvr;
+       const u32 *value;
 
        if (get_property(cpunode, "dynamic-power-step", NULL) == NULL)
                return 1;
 
        hi_freq = cur_freq;
-       value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL);
+       value = get_property(cpunode, "reduced-clock-frequency", NULL);
        if (!value)
                return 1;
        low_freq = (*value) / 1000;
@@ -653,7 +651,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
 static int __init pmac_cpufreq_setup(void)
 {
        struct device_node      *cpunode;
-       u32                     *value;
+       const u32               *value;
 
        if (strstr(cmd_line, "nocpufreq"))
                return 0;
@@ -664,7 +662,7 @@ static int __init pmac_cpufreq_setup(void)
                goto out;
 
        /* Get current cpu clock freq */
-       value = (u32 *)get_property(cpunode, "clock-frequency", NULL);
+       value = get_property(cpunode, "clock-frequency", NULL);
        if (!value)
                goto out;
        cur_freq = (*value) / 1000;