mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
hwmon: (w83627ehf) Fix negative 8-bit temperature values
Since 8-bit temperature values are now handled in 16-bit struct
members, values have to be cast to s8 for negative temperatures to be
properly handled. This is broken since kernel version 2.6.39
(commit bce26c58df.)
Signed-off-by: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: [email protected] # 2.6.39+
Signed-off-by: Guenter Roeck <[email protected]>
This commit is contained in:
parent
899e3ee404
commit
133d324d82
1 changed files with 3 additions and 2 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue