]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] hwmon: hwmon vs i2c, second round (11/11)
authorJean Delvare <khali@linux-fr.org>
Sun, 31 Jul 2005 20:12:09 +0000 (22:12 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Sep 2005 16:14:24 +0000 (09:14 -0700)
Use the common vid_from_reg function in lm78 rather than
reimplementing it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/hwmon/Kconfig
drivers/hwmon/lm78.c

index 35fe7d1d40287c03b70aa9d8b72ce7fa6ba0c3e7..138dc50270e3e51e714893602c937b5fa95ec14e 100644 (file)
@@ -207,6 +207,7 @@ config SENSORS_LM78
        tristate "National Semiconductor LM78 and compatibles"
        depends on HWMON && I2C && EXPERIMENTAL
        select I2C_ISA
+       select HWMON_VID
        help
          If you say yes here you get support for National Semiconductor LM78,
          LM78-J and LM79.
index 51c0b37c4990e1284f4304917fc3cf714776231e..f6730dc3573b68096814ccff7e8a898aae45122a 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
 #include <linux/hwmon.h>
+#include <linux/hwmon-vid.h>
 #include <linux/err.h>
 #include <asm/io.h>
 
@@ -106,13 +107,6 @@ static inline int TEMP_FROM_REG(s8 val)
        return val * 1000;
 }
 
-/* VID: mV
-   REG: (see doc/vid) */
-static inline int VID_FROM_REG(u8 val)
-{
-       return val==0x1f ? 0 : val>=0x10 ? 5100-val*100 : 2050-val*50;
-}
-
 #define DIV_FROM_REG(val) (1 << (val))
 
 /* There are some complications in a module like this. First off, LM78 chips
@@ -457,7 +451,7 @@ static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL);
 static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct lm78_data *data = lm78_update_device(dev);
-       return sprintf(buf, "%d\n", VID_FROM_REG(data->vid));
+       return sprintf(buf, "%d\n", vid_from_reg(82, data->vid));
 }
 static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);