[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100313002713.434639177@kvm.kroah.org>
Date: Fri, 12 Mar 2010 16:27:07 -0800
From: Greg KH <gregkh@...e.de>
To: linux-kernel@...r.kernel.org, stable@...nel.org
Cc: stable-review@...nel.org, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org, alan@...rguk.ukuu.org.uk,
Jean Delvare <khali@...ux-fr.org>
Subject: [094/145] hwmon: (tmp421) Fix temperature conversions
2.6.32-stable review patch. If anyone has any objections, please let me know.
----------------
From: Jean Delvare <khali@...ux-fr.org>
commit a44908d742a577fb5ccb9a8c082326d4cea234c2 upstream.
The low bits of temperature registers are status bits, they must be
masked out before converting the register values to temperatures.
Signed-off-by: Jean Delvare <khali@...ux-fr.org>
Tested-by: Andre Prendel <andre.prendel@....de>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
---
drivers/hwmon/tmp421.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -81,14 +81,16 @@ struct tmp421_data {
static int temp_from_s16(s16 reg)
{
- int temp = reg;
+ /* Mask out status bits */
+ int temp = reg & ~0xf;
return (temp * 1000 + 128) / 256;
}
static int temp_from_u16(u16 reg)
{
- int temp = reg;
+ /* Mask out status bits */
+ int temp = reg & ~0xf;
/* Add offset for extended temperature range. */
temp -= 64 * 256;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists