aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r--drivers/acpi/thermal.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 8d4b79b4f933..c4e00ac8ea85 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -879,6 +879,8 @@ static void acpi_thermal_check(void *data)
879} 879}
880 880
881/* sys I/F for generic thermal sysfs support */ 881/* sys I/F for generic thermal sysfs support */
882#define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200)
883
882static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) 884static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
883{ 885{
884 struct acpi_thermal *tz = thermal->devdata; 886 struct acpi_thermal *tz = thermal->devdata;
@@ -886,7 +888,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
886 if (!tz) 888 if (!tz)
887 return -EINVAL; 889 return -EINVAL;
888 890
889 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(tz->temperature)); 891 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature));
890} 892}
891 893
892static const char enabled[] = "kernel"; 894static const char enabled[] = "kernel";
@@ -980,21 +982,21 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
980 982
981 if (tz->trips.critical.flags.valid) { 983 if (tz->trips.critical.flags.valid) {
982 if (!trip) 984 if (!trip)
983 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( 985 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
984 tz->trips.critical.temperature)); 986 tz->trips.critical.temperature));
985 trip--; 987 trip--;
986 } 988 }
987 989
988 if (tz->trips.hot.flags.valid) { 990 if (tz->trips.hot.flags.valid) {
989 if (!trip) 991 if (!trip)
990 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( 992 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
991 tz->trips.hot.temperature)); 993 tz->trips.hot.temperature));
992 trip--; 994 trip--;
993 } 995 }
994 996
995 if (tz->trips.passive.flags.valid) { 997 if (tz->trips.passive.flags.valid) {
996 if (!trip) 998 if (!trip)
997 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( 999 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
998 tz->trips.passive.temperature)); 1000 tz->trips.passive.temperature));
999 trip--; 1001 trip--;
1000 } 1002 }
@@ -1002,7 +1004,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
1002 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && 1004 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
1003 tz->trips.active[i].flags.valid; i++) { 1005 tz->trips.active[i].flags.valid; i++) {
1004 if (!trip) 1006 if (!trip)
1005 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( 1007 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
1006 tz->trips.active[i].temperature)); 1008 tz->trips.active[i].temperature));
1007 trip--; 1009 trip--;
1008 } 1010 }