From 622594be1e235a29dcd634d2ba7f4d3723730b1b Mon Sep 17 00:00:00 2001 From: Philip Edelbrock Date: Thu, 3 Aug 2000 22:40:43 +0000 Subject: [PATCH] (Phil) Modified REG_TO_TEMP to work with negative values. Some testing is needed. (Which I will do immediately after this commit.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@851 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/chips/lm75.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/chips/lm75.c b/kernel/chips/lm75.c index 2d7303f2..f759ff42 100644 --- a/kernel/chips/lm75.c +++ b/kernel/chips/lm75.c @@ -57,7 +57,7 @@ SENSORS_INSMOD_1(lm75); 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 TEMP_FROM_REG(val) (((val) >> 7) * 5) +#define TEMP_FROM_REG(val) ((((val & 0x7fff) >> 7) * 5) | ((val & 0x8000)?-256:0)) #define TEMP_TO_REG(val) (SENSORS_LIMIT(((((val) + 2) / 5) << 7),0,0xffff)) /* Initial values */