diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-23 10:43:31 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-23 10:43:31 +0300 |
commit | 5117cc25fd43add94c04c9d2ace713c69a21bdb1 (patch) | |
tree | 866ee03e42337edbc1cd41d0e761ca82d0806c83 | |
parent | 2efd7c0fdcbe041173e248ccc2d9c91df7f84ce5 (diff) | |
parent | 133d324d82e144588939ad25b732b5b6c33b03d9 (diff) | |
download | blackbird-op-linux-5117cc25fd43add94c04c9d2ace713c69a21bdb1.tar.gz blackbird-op-linux-5117cc25fd43add94c04c9d2ace713c69a21bdb1.zip |
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (w83627ehf) Fix negative 8-bit temperature values
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 7b0260dc76fb..36d7f270b14d 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -390,7 +390,7 @@ temp_from_reg(u16 reg, s16 regval) { if (is_word_sized(reg)) return LM75_TEMP_FROM_REG(regval); - return regval * 1000; + return ((s8)regval) * 1000; } static inline u16 @@ -398,7 +398,8 @@ temp_to_reg(u16 reg, long temp) { if (is_word_sized(reg)) return LM75_TEMP_TO_REG(temp); - return DIV_ROUND_CLOSEST(SENSORS_LIMIT(temp, -127000, 128000), 1000); + return (s8)DIV_ROUND_CLOSEST(SENSORS_LIMIT(temp, -127000, 128000), + 1000); } /* Some of analog inputs have internal scaling (2x), 8mV is ADC LSB */ |