diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-03-13 13:34:04 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-16 17:53:07 -0700 |
commit | f14b7f8d566e929aba7db0abf87f5e61420eb7d5 (patch) | |
tree | e8600b6af918a1c8185ea74cb23a290c8569c843 | |
parent | 187203ae140ba1f2b617c3e9671f9e1fcb125a68 (diff) | |
download | lwn-f14b7f8d566e929aba7db0abf87f5e61420eb7d5.tar.gz lwn-f14b7f8d566e929aba7db0abf87f5e61420eb7d5.zip |
hwmon: (it87) Properly decode -128 degrees C temperature
commit e267d25005c861fe6afda343f044536342c9f8b4 upstream
The it87 driver is reporting -128 degrees C as +128 degrees C.
That's not a terribly likely temperature value but let's still
get it right, especially when it simplifies the code.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/hwmon/it87.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index d793cc011990..c620b2000fab 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -207,7 +207,7 @@ static inline u16 FAN16_TO_REG(long rpm) #define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-500)/1000):\ ((val)+500)/1000),-128,127)) -#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000) +#define TEMP_FROM_REG(val) ((val) * 1000) #define PWM_TO_REG(val) ((val) >> 1) #define PWM_FROM_REG(val) (((val)&0x7f) << 1) @@ -261,9 +261,9 @@ struct it87_data { u8 has_fan; /* Bitfield, fans enabled */ u16 fan[5]; /* Register values, possibly combined */ u16 fan_min[5]; /* Register values, possibly combined */ - u8 temp[3]; /* Register value */ - u8 temp_high[3]; /* Register value */ - u8 temp_low[3]; /* Register value */ + s8 temp[3]; /* Register value */ + s8 temp_high[3]; /* Register value */ + s8 temp_low[3]; /* Register value */ u8 sensor; /* Register value */ u8 fan_div[3]; /* Register encoding, shifted right */ u8 vid; /* Register encoding, combined */ |