fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / macintosh / therm_pm72.c
index 20bf672..0d3c1f9 100644 (file)
 #include <asm/sections.h>
 #include <asm/of_device.h>
 #include <asm/macio.h>
+#include <asm/of_platform.h>
 
 #include "therm_pm72.h"
 
@@ -660,7 +661,7 @@ static int read_eeprom(int cpu, struct mpu_data *out)
 {
        struct device_node *np;
        char nodename[64];
-       u8 *data;
+       const u8 *data;
        int len;
 
        /* prom.c routine for finding a node by path is a bit brain dead
@@ -673,7 +674,7 @@ static int read_eeprom(int cpu, struct mpu_data *out)
                printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n");
                return -ENODEV;
        }
-       data = (u8 *)get_property(np, "cpuid", &len);
+       data = get_property(np, "cpuid", &len);
        if (data == NULL) {
                printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n");
                of_node_put(np);
@@ -970,10 +971,16 @@ static void do_monitor_cpu_combined(void)
                printk(KERN_WARNING "Warning ! Temperature way above maximum (%d) !\n",
                       temp_combi >> 16);
                state0->overtemp += CPU_MAX_OVERTEMP / 4;
-       } else if (temp_combi > (state0->mpu.tmax << 16))
+       } else if (temp_combi > (state0->mpu.tmax << 16)) {
                state0->overtemp++;
-       else
+               printk(KERN_WARNING "Temperature %d above max %d. overtemp %d\n",
+                      temp_combi >> 16, state0->mpu.tmax, state0->overtemp);
+       } else {
+               if (state0->overtemp)
+                       printk(KERN_WARNING "Temperature back down to %d\n",
+                              temp_combi >> 16);
                state0->overtemp = 0;
+       }
        if (state0->overtemp >= CPU_MAX_OVERTEMP)
                critical_state = 1;
        if (state0->overtemp > 0) {
@@ -1045,10 +1052,16 @@ static void do_monitor_cpu_split(struct cpu_pid_state *state)
                       " (%d) !\n",
                       state->index, temp >> 16);
                state->overtemp += CPU_MAX_OVERTEMP / 4;
-       } else if (temp > (state->mpu.tmax << 16))
+       } else if (temp > (state->mpu.tmax << 16)) {
                state->overtemp++;
-       else
+               printk(KERN_WARNING "CPU %d temperature %d above max %d. overtemp %d\n",
+                      state->index, temp >> 16, state->mpu.tmax, state->overtemp);
+       } else {
+               if (state->overtemp)
+                       printk(KERN_WARNING "CPU %d temperature back down to %d\n",
+                              state->index, temp >> 16);
                state->overtemp = 0;
+       }
        if (state->overtemp >= CPU_MAX_OVERTEMP)
                critical_state = 1;
        if (state->overtemp > 0) {
@@ -1107,10 +1120,16 @@ static void do_monitor_cpu_rack(struct cpu_pid_state *state)
                       " (%d) !\n",
                       state->index, temp >> 16);
                state->overtemp = CPU_MAX_OVERTEMP / 4;
-       } else if (temp > (state->mpu.tmax << 16))
+       } else if (temp > (state->mpu.tmax << 16)) {
                state->overtemp++;
-       else
+               printk(KERN_WARNING "CPU %d temperature %d above max %d. overtemp %d\n",
+                      state->index, temp >> 16, state->mpu.tmax, state->overtemp);
+       } else {
+               if (state->overtemp)
+                       printk(KERN_WARNING "CPU %d temperature back down to %d\n",
+                              state->index, temp >> 16);
                state->overtemp = 0;
+       }
        if (state->overtemp >= CPU_MAX_OVERTEMP)
                critical_state = 1;
        if (state->overtemp > 0) {
@@ -1336,7 +1355,7 @@ static int init_backside_state(struct backside_pid_state *state)
         */
        u3 = of_find_node_by_path("/u3@0,f8000000");
        if (u3 != NULL) {
-               u32 *vers = (u32 *)get_property(u3, "device-rev", NULL);
+               const u32 *vers = get_property(u3, "device-rev", NULL);
                if (vers)
                        if (((*vers) & 0x3f) < 0x34)
                                u3h = 0;
@@ -2111,8 +2130,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node)
 
        while ((np = of_get_next_child(fcu_node, np)) != NULL) {
                int type = -1;
-               char *loc;
-               u32 *reg;
+               const char *loc;
+               const u32 *reg;
 
                DBG(" control: %s, type: %s\n", np->name, np->type);
 
@@ -2128,8 +2147,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node)
                        continue;
 
                /* Lookup for a matching location */
-               loc = (char *)get_property(np, "location", NULL);
-               reg = (u32 *)get_property(np, "reg", NULL);
+               loc = get_property(np, "location", NULL);
+               reg = get_property(np, "reg", NULL);
                if (loc == NULL || reg == NULL)
                        continue;
                DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg);
@@ -2236,14 +2255,14 @@ static int __init therm_pm72_init(void)
                return -ENODEV;
        }
 
-       of_register_driver(&fcu_of_platform_driver);
+       of_register_platform_driver(&fcu_of_platform_driver);
        
        return 0;
 }
 
 static void __exit therm_pm72_exit(void)
 {
-       of_unregister_driver(&fcu_of_platform_driver);
+       of_unregister_platform_driver(&fcu_of_platform_driver);
 
        if (of_dev)
                of_device_unregister(of_dev);