hwmon: (applesmc) Allow negative temperature values
authorHenrik Rydberg <rydberg@euromail.se>
Mon, 16 Jul 2012 07:18:10 +0000 (09:18 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 22 Jul 2012 04:48:45 +0000 (21:48 -0700)
commitb6e5122f09272cb30c2e1fc1d80a40bfa6e87757
treee166c109e4d9da60aa1f6590c302042fff716729
parent41bf870e6db130c6e467c70b6da96398066b8be7
hwmon: (applesmc) Allow negative temperature values

There are many userland reports of sensors with unreasonably small and
large temperatures. There seem to be several reasons for this:

Firstly, the major sensor type (sp78) is actually a signed number.
This explains why some sensors show very small or large values - they
are in fact all small, but of different sign.

Secondly, the other sensor type (1-hex) is not properly understood; it
may be that it is not a temperature after all.

Thirdly, some sensors are differential in nature, showing changes over
time rather than absolute numbers.  This explains why those values are
small and of varying sign.

This patch interprets the sp78 type as signed short, but keeps the
original scaling. For other types, -EINVAL is returned, since the
nature of those sensors is unknown.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/applesmc.c