ACPI: thermal: show temperature in millidegree Celsius
authorZhang, Rui <rui.zhang@intel.com>
Wed, 27 Feb 2008 23:51:30 +0000 (07:51 +0800)
committerLen Brown <len.brown@intel.com>
Thu, 13 Mar 2008 05:49:11 +0000 (01:49 -0400)
as now required by the generic thermal I/F

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/thermal.c

index 8d4b79b4f933c631281e23ce8b602e3bcbbf3d9f..c4e00ac8ea855ac980b05b5e6bf60b8e52b5016b 100644 (file)
@@ -879,6 +879,8 @@ static void acpi_thermal_check(void *data)
 }
 
 /* sys I/F for generic thermal sysfs support */
+#define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200)
+
 static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
 {
        struct acpi_thermal *tz = thermal->devdata;
@@ -886,7 +888,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
        if (!tz)
                return -EINVAL;
 
-       return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(tz->temperature));
+       return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature));
 }
 
 static const char enabled[] = "kernel";
@@ -980,21 +982,21 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
 
        if (tz->trips.critical.flags.valid) {
                if (!trip)
-                       return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(
+                       return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
                                tz->trips.critical.temperature));
                trip--;
        }
 
        if (tz->trips.hot.flags.valid) {
                if (!trip)
-                       return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(
+                       return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
                                        tz->trips.hot.temperature));
                trip--;
        }
 
        if (tz->trips.passive.flags.valid) {
                if (!trip)
-                       return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(
+                       return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
                                        tz->trips.passive.temperature));
                trip--;
        }
@@ -1002,7 +1004,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
        for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
                tz->trips.active[i].flags.valid; i++) {
                if (!trip)
-                       return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(
+                       return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
                                        tz->trips.active[i].temperature));
                trip--;
        }