Commit 5117cc25 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'hwmon-for-linus' of...

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
parents 2efd7c0f 133d324d
...@@ -390,7 +390,7 @@ temp_from_reg(u16 reg, s16 regval) ...@@ -390,7 +390,7 @@ temp_from_reg(u16 reg, s16 regval)
{ {
if (is_word_sized(reg)) if (is_word_sized(reg))
return LM75_TEMP_FROM_REG(regval); return LM75_TEMP_FROM_REG(regval);
return regval * 1000; return ((s8)regval) * 1000;
} }
static inline u16 static inline u16
...@@ -398,7 +398,8 @@ temp_to_reg(u16 reg, long temp) ...@@ -398,7 +398,8 @@ temp_to_reg(u16 reg, long temp)
{ {
if (is_word_sized(reg)) if (is_word_sized(reg))
return LM75_TEMP_TO_REG(temp); 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 */ /* Some of analog inputs have internal scaling (2x), 8mV is ADC LSB */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment