Hi Michael,
The debian kernel source shows the following so the patch is rejected
when applied:
static inline u16 LM77_TEMP_TO_REG(int temp)
{
int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX);
ntemp = (ntemp / 500) << 3;
/* set all sign bits if necessary */
if (ntemp & 0x200)
ntemp |= 0xe000;
return (u16)ntemp;
}
static inline int LM77_TEMP_FROM_REG(u16 reg)
{
int val = ((reg & LM77_TEMP_MASK) >> 3);
/* adjust for signedness if necessary */
if (val & 0x200)
val -= 1024;
return (val *= 500);
}
Michael Renzmann wrote:
Hi all.
This is a revised version of my previous patch to fix negative
temperature readings of the LM77 in kernel 2.6.x.
Bye, Mike
------------------------------------------------------------------------
Subject:
[PATCH 01/11] hwmon: Fix negative temperature readings in lm77 driver
From:
Jean Delvare <[EMAIL PROTECTED]>
Date:
Mon, 9 Jan 2006 22:43:08 +0100
To:
Greg KH <[EMAIL PROTECTED]>
To:
Greg KH <[EMAIL PROTECTED]>
CC:
LM Sensors <[EMAIL PROTECTED]>, Michael Renzmann
<[EMAIL PROTECTED]>
Content-Disposition: inline; filename=hwmon-lm77-negative-temp-fix.patch
Fix negative temperature readings in lm77 driver.
Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
Acked-by: Michael Renzmann <[EMAIL PROTECTED]>
---
drivers/hwmon/lm77.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- linux-2.6.15-rc6.orig/drivers/hwmon/lm77.c 2005-12-19 20:15:58.000000000
+0100
+++ linux-2.6.15-rc6/drivers/hwmon/lm77.c 2005-12-20 19:44:11.000000000
+0100
@@ -87,15 +87,15 @@
/* In the temperature registers, the low 3 bits are not part of the
temperature values; they are the status bits. */
-static inline u16 LM77_TEMP_TO_REG(int temp)
+static inline s16 LM77_TEMP_TO_REG(int temp)
{
int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX);
- return (u16)((ntemp / 500) * 8);
+ return (ntemp / 500) * 8;
}
-static inline int LM77_TEMP_FROM_REG(u16 reg)
+static inline int LM77_TEMP_FROM_REG(s16 reg)
{
- return ((int)reg / 8) * 500;
+ return (reg / 8) * 500;
}
/* sysfs stuff */
------------------------------------------------------------------------
_______________________________________________
Voyage-linux mailing list
[email protected]
http://list.voyage.hk/mailman/listinfo/voyage-linux
--
Regards,
Punky
P U N K N ! X . c o m
Technology + Lifestyle
(http://www.punknix.com)
Voyage Linux
(http://www.voyage.hk/software/voyage.html)
_______________________________________________
Voyage-linux mailing list
[email protected]
http://list.voyage.hk/mailman/listinfo/voyage-linux