diff options
-rw-r--r-- | drivers/hwmon/lm80.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index bd0a1ebbf867..8e9a0b1dc437 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c | |||
@@ -86,18 +86,7 @@ static inline unsigned char FAN_TO_REG(unsigned rpm, unsigned div) | |||
86 | #define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : \ | 86 | #define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : \ |
87 | (val) == 255 ? 0 : 1350000/((div) * (val))) | 87 | (val) == 255 ? 0 : 1350000/((div) * (val))) |
88 | 88 | ||
89 | static inline long TEMP_FROM_REG(u16 temp) | 89 | #define TEMP_FROM_REG(temp) ((temp) * 125 / 32) |
90 | { | ||
91 | long res; | ||
92 | |||
93 | temp >>= 4; | ||
94 | if (temp < 0x0800) | ||
95 | res = 625 * (long) temp; | ||
96 | else | ||
97 | res = ((long) temp - 0x01000) * 625; | ||
98 | |||
99 | return res / 10; | ||
100 | } | ||
101 | 90 | ||
102 | #define TEMP_LIMIT_FROM_REG(val) (((val) > 0x80 ? \ | 91 | #define TEMP_LIMIT_FROM_REG(val) (((val) > 0x80 ? \ |
103 | (val) - 0x100 : (val)) * 1000) | 92 | (val) - 0x100 : (val)) * 1000) |
@@ -124,7 +113,7 @@ struct lm80_data { | |||
124 | u8 fan[2]; /* Register value */ | 113 | u8 fan[2]; /* Register value */ |
125 | u8 fan_min[2]; /* Register value */ | 114 | u8 fan_min[2]; /* Register value */ |
126 | u8 fan_div[2]; /* Register encoding, shifted right */ | 115 | u8 fan_div[2]; /* Register encoding, shifted right */ |
127 | u16 temp; /* Register values, shifted right */ | 116 | s16 temp; /* Register values */ |
128 | u8 temp_hot_max; /* Register value */ | 117 | u8 temp_hot_max; /* Register value */ |
129 | u8 temp_hot_hyst; /* Register value */ | 118 | u8 temp_hot_hyst; /* Register value */ |
130 | u8 temp_os_max; /* Register value */ | 119 | u8 temp_os_max; /* Register value */ |
@@ -309,7 +298,7 @@ static ssize_t show_temp_input1(struct device *dev, | |||
309 | struct lm80_data *data = lm80_update_device(dev); | 298 | struct lm80_data *data = lm80_update_device(dev); |
310 | if (IS_ERR(data)) | 299 | if (IS_ERR(data)) |
311 | return PTR_ERR(data); | 300 | return PTR_ERR(data); |
312 | return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp)); | 301 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); |
313 | } | 302 | } |
314 | 303 | ||
315 | #define show_temp(suffix, value) \ | 304 | #define show_temp(suffix, value) \ |