ACPI: thermal: show temperature in millidegree Celsius

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>
This commit is contained in:
Zhang, Rui 2008-02-28 07:51:30 +08:00 committed by Len Brown
parent 3152fb9f11
commit 5e012760df
1 changed files with 7 additions and 5 deletions

View File

@ -879,6 +879,8 @@ static void acpi_thermal_check(void *data)
} }
/* sys I/F for generic thermal sysfs support */ /* 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) static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
{ {
struct acpi_thermal *tz = thermal->devdata; struct acpi_thermal *tz = thermal->devdata;
@ -886,7 +888,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
if (!tz) if (!tz)
return -EINVAL; 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"; 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 (tz->trips.critical.flags.valid) {
if (!trip) if (!trip)
return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
tz->trips.critical.temperature)); tz->trips.critical.temperature));
trip--; trip--;
} }
if (tz->trips.hot.flags.valid) { if (tz->trips.hot.flags.valid) {
if (!trip) if (!trip)
return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
tz->trips.hot.temperature)); tz->trips.hot.temperature));
trip--; trip--;
} }
if (tz->trips.passive.flags.valid) { if (tz->trips.passive.flags.valid) {
if (!trip) if (!trip)
return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
tz->trips.passive.temperature)); tz->trips.passive.temperature));
trip--; trip--;
} }
@ -1002,7 +1004,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
tz->trips.active[i].flags.valid; i++) { tz->trips.active[i].flags.valid; i++) {
if (!trip) if (!trip)
return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
tz->trips.active[i].temperature)); tz->trips.active[i].temperature));
trip--; trip--;
} }