Skip to content

Commit

Permalink
ACPI: thinkpad-acpi: make sure DSDT TMPx readings don't return +128
Browse files Browse the repository at this point in the history
We get +128 instead of -128 from the DSDT TMPx methods, due to errors when
converting a EC byte return that is a s8 to an ACPI handler return that is
an int.

Fix it once and for all, by clamping acceptable temperature readings from
DSDT TMPx so that anything outside the [-127,+127] range is converted to
TP_EC_THERMAL_TMP_NA (-128).

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Michael Olbrich <michael.olbrich@gmx.net>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Henrique de Moraes Holschuh authored and Len Brown committed Jul 22, 2007
1 parent edf0e0e commit a8fba3d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/misc/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2853,6 +2853,8 @@ static int thermal_get_sensor(int idx, s32 *value)
snprintf(tmpi, sizeof(tmpi), "TMP%c", '0' + idx);
if (!acpi_evalf(ec_handle, &t, tmpi, "d"))
return -EIO;
if (t > 127 || t < -127)
t = TP_EC_THERMAL_TMP_NA;
*value = t * 1000;
return 0;
}
Expand Down

0 comments on commit a8fba3d

Please sign in to comment.