]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/macintosh/windfarm_lm75_sensor.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
[linux-2.6-omap-h63xx.git] / drivers / macintosh / windfarm_lm75_sensor.c
index 423bfa2432c02ad4939219c40e2a177f33cf0f8c..b92b959fe16e3a9d57ad4a610bd137f138a3d25d 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/init.h>
 #include <linux/wait.h>
 #include <linux/i2c.h>
-#include <linux/i2c-dev.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/io.h>
@@ -118,10 +117,9 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
        DBG("wf_lm75: creating  %s device at address 0x%02x\n",
            ds1775 ? "ds1775" : "lm75", addr);
 
-       lm = kmalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
+       lm = kzalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL);
        if (lm == NULL)
                return NULL;
-       memset(lm, 0, sizeof(struct wf_lm75_sensor));
 
        /* Usual rant about sensor names not beeing very consistent in
         * the device-tree, oh well ...
@@ -129,6 +127,12 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
         */
        if (!strcmp(loc, "Hard drive") || !strcmp(loc, "DRIVE BAY"))
                lm->sens.name = "hd-temp";
+       else if (!strcmp(loc, "Incoming Air Temp"))
+               lm->sens.name = "incoming-air-temp";
+       else if (!strcmp(loc, "ODD Temp"))
+               lm->sens.name = "optical-drive-temp";
+       else if (!strcmp(loc, "HD Temp"))
+               lm->sens.name = "hard-drive-temp";
        else
                goto fail;
 
@@ -177,7 +181,7 @@ static int wf_lm75_attach(struct i2c_adapter *adapter)
        for (dev = NULL;
             (dev = of_get_next_child(busnode, dev)) != NULL;) {
                const char *loc =
-                       get_property(dev, "hwsensor-location", NULL);
+                       of_get_property(dev, "hwsensor-location", NULL);
                u8 addr;
 
                /* We must re-match the adapter in order to properly check
@@ -189,10 +193,10 @@ static int wf_lm75_attach(struct i2c_adapter *adapter)
                if (loc == NULL || addr == 0)
                        continue;
                /* real lm75 */
-               if (device_is_compatible(dev, "lm75"))
+               if (of_device_is_compatible(dev, "lm75"))
                        wf_lm75_create(adapter, addr, 0, loc);
                /* ds1775 (compatible, better resolution */
-               else if (device_is_compatible(dev, "ds1775"))
+               else if (of_device_is_compatible(dev, "ds1775"))
                        wf_lm75_create(adapter, addr, 1, loc);
        }
        return 0;