--- ./drivers/sensors/lm75.c.orig Mon Dec 15 02:31:12 2003 +++ ./drivers/sensors/lm75.c Mon Dec 15 02:38:24 2003 @@ -25,7 +25,7 @@ #include #define LM_DATE "20031211" #define LM_VERSION "2.8.2" -#include "lm75.h" +//#include "lm75.h" /* Addresses to scan */ static unsigned short normal_i2c[] = { SENSORS_I2C_END }; @@ -43,6 +43,13 @@ #define LM75_REG_CONF 0x01 #define LM75_REG_TEMP_HYST 0x02 #define LM75_REG_TEMP_OS 0x03 + +/* Conversions. Rounding and limit checking is only done on the TO_REG + variants. Note that you should be a bit careful with which arguments + these macros are called: arguments may be evaluated more than once. + Fixing this is just not worth it. */ +#define LM75_TEMP_FROM_REG(val) ((((val & 0x7fff) >> 7) * 5) | ((val & 0x8000)?-256:0)) +#define LM75_TEMP_TO_REG(val) (SENSORS_LIMIT((val<0?(0x200+((val)/5))<<7:(((val) + 2) / 5) << 7),0,0xffff)) /* Each client has this additional data */ struct lm75_data {