Merge branch 'for-linus' of git://neil.brown.name/md
[safe/jmp/linux-2.6] / drivers / macintosh / windfarm_max6690_sensor.c
index 8e99d40..e207a90 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
-#include <linux/i2c-dev.h>
 #include <asm/prom.h>
 #include <asm/pmac_low_i2c.h>
 
@@ -78,18 +77,28 @@ static struct wf_sensor_ops wf_max6690_ops = {
        .owner          = THIS_MODULE,
 };
 
-static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr)
+static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr,
+                             const char *loc)
 {
        struct wf_6690_sensor *max;
-       char *name = "backside-temp";
+       char *name;
 
        max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL);
        if (max == NULL) {
                printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: "
-                      "no memory\n", name);
+                      "no memory\n", loc);
                return;
        }
 
+       if (!strcmp(loc, "BACKSIDE"))
+               name = "backside-temp";
+       else if (!strcmp(loc, "NB Ambient"))
+               name = "north-bridge-temp";
+       else if (!strcmp(loc, "GPU Ambient"))
+               name = "gpu-temp";
+       else
+               goto fail;
+
        max->sens.ops = &wf_max6690_ops;
        max->sens.name = name;
        max->i2c.addr = addr >> 1;
@@ -132,16 +141,14 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
                 */
                if (!pmac_i2c_match_adapter(dev, adapter))
                        continue;
-               if (!device_is_compatible(dev, "max6690"))
+               if (!of_device_is_compatible(dev, "max6690"))
                        continue;
                addr = pmac_i2c_get_dev_addr(dev);
-               loc = get_property(dev, "hwsensor-location", NULL);
+               loc = of_get_property(dev, "hwsensor-location", NULL);
                if (loc == NULL || addr == 0)
                        continue;
                printk("found max6690, loc=%s addr=0x%02x\n", loc, addr);
-               if (strcmp(loc, "BACKSIDE"))
-                       continue;
-               wf_max6690_create(adapter, addr);
+               wf_max6690_create(adapter, addr, loc);
        }
 
        return 0;