Commit e267d25005c861fe6afda343f044536342c9f8b4

Authored by Jean Delvare
1 parent 1a51e068c9

hwmon: (it87) Properly decode -128 degrees C temperature

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>

Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff

drivers/hwmon/it87.c
... ... @@ -213,7 +213,7 @@
213 213  
214 214 #define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0?(((val)-500)/1000):\
215 215 ((val)+500)/1000),-128,127))
216   -#define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*1000)
  216 +#define TEMP_FROM_REG(val) ((val) * 1000)
217 217  
218 218 #define PWM_TO_REG(val) ((val) >> 1)
219 219 #define PWM_FROM_REG(val) (((val)&0x7f) << 1)
... ... @@ -267,9 +267,9 @@
267 267 u8 has_fan; /* Bitfield, fans enabled */
268 268 u16 fan[5]; /* Register values, possibly combined */
269 269 u16 fan_min[5]; /* Register values, possibly combined */
270   - u8 temp[3]; /* Register value */
271   - u8 temp_high[3]; /* Register value */
272   - u8 temp_low[3]; /* Register value */
  270 + s8 temp[3]; /* Register value */
  271 + s8 temp_high[3]; /* Register value */
  272 + s8 temp_low[3]; /* Register value */
273 273 u8 sensor; /* Register value */
274 274 u8 fan_div[3]; /* Register encoding, shifted right */
275 275 u8 vid; /* Register encoding, combined */