Module Name: src Committed By: pgoyette Date: Thu Feb 18 14:10:15 UTC 2010
Modified Files: src/sys/dev/acpi: acpi_tz.c Log Message: Print correct temperature value, and properly display negative temperatures. Resolves PR kern/36615 To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/acpi/acpi_tz.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/acpi_tz.c diff -u src/sys/dev/acpi/acpi_tz.c:1.58 src/sys/dev/acpi/acpi_tz.c:1.59 --- src/sys/dev/acpi/acpi_tz.c:1.58 Sun Feb 14 23:06:58 2010 +++ src/sys/dev/acpi/acpi_tz.c Thu Feb 18 14:10:15 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_tz.c,v 1.58 2010/02/14 23:06:58 pgoyette Exp $ */ +/* $NetBSD: acpi_tz.c,v 1.59 2010/02/18 14:10:15 pgoyette Exp $ */ /* * Copyright (c) 2003 Jared D. McNeill <jmcne...@invisible.ca> @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.58 2010/02/14 23:06:58 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.59 2010/02/18 14:10:15 pgoyette Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -355,9 +355,11 @@ acpitz_celcius_string(int dk) { static char buf[10]; + int dc; - snprintf(buf, sizeof(buf), "%d.%d", (dk - ATZ_ZEROC) / 10, - (dk - ATZ_ZEROC) % 10); + dc = abs(dk - ATZ_ZEROC); + snprintf(buf, sizeof(buf), "%s%d.%d", (dk >= ATZ_ZEROC)?"":"-", + dc / 10, dc % 10); return buf; } @@ -526,7 +528,7 @@ acpitz_celcius_string(sc->sc_zone.hot)); if (sc->sc_zone.psv != ATZ_TMP_INVALID) aprint_normal(" passive %sC", - acpitz_celcius_string(sc->sc_zone.tmp)); + acpitz_celcius_string(sc->sc_zone.psv)); } if (valid_levels == 0) {