aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-07-31 16:12:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 12:14:24 -0400
commit19f673eddb5a406be72989fb57b7f286772b8cf4 (patch)
treed552112cd0721467e6ff0a13f8eef7c3491c847c /drivers/hwmon
parentd0f282706df877f8fd8869419e308d24eedb523b (diff)
[PATCH] hwmon: hwmon vs i2c, second round (11/11)
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/Kconfig1
-rw-r--r--drivers/hwmon/lm78.c10
2 files changed, 3 insertions, 8 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 35fe7d1d4028..138dc50270e3 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -207,6 +207,7 @@ config SENSORS_LM78
207 tristate "National Semiconductor LM78 and compatibles" 207 tristate "National Semiconductor LM78 and compatibles"
208 depends on HWMON && I2C && EXPERIMENTAL 208 depends on HWMON && I2C && EXPERIMENTAL
209 select I2C_ISA 209 select I2C_ISA
210 select HWMON_VID
210 help 211 help
211 If you say yes here you get support for National Semiconductor LM78, 212 If you say yes here you get support for National Semiconductor LM78,
212 LM78-J and LM79. 213 LM78-J and LM79.
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index 51c0b37c4990..f6730dc3573b 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -25,6 +25,7 @@
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/i2c-isa.h> 26#include <linux/i2c-isa.h>
27#include <linux/hwmon.h> 27#include <linux/hwmon.h>
28#include <linux/hwmon-vid.h>
28#include <linux/err.h> 29#include <linux/err.h>
29#include <asm/io.h> 30#include <asm/io.h>
30 31
@@ -106,13 +107,6 @@ static inline int TEMP_FROM_REG(s8 val)
106 return val * 1000; 107 return val * 1000;
107} 108}
108 109
109/* VID: mV
110 REG: (see doc/vid) */
111static inline int VID_FROM_REG(u8 val)
112{
113 return val==0x1f ? 0 : val>=0x10 ? 5100-val*100 : 2050-val*50;
114}
115
116#define DIV_FROM_REG(val) (1 << (val)) 110#define DIV_FROM_REG(val) (1 << (val))
117 111
118/* There are some complications in a module like this. First off, LM78 chips 112/* 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);
457static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) 451static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
458{ 452{
459 struct lm78_data *data = lm78_update_device(dev); 453 struct lm78_data *data = lm78_update_device(dev);
460 return sprintf(buf, "%d\n", VID_FROM_REG(data->vid)); 454 return sprintf(buf, "%d\n", vid_from_reg(82, data->vid));
461} 455}
462static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 456static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
463 457