aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/thermal.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 14:52:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 14:52:52 -0400
commit08acd4f8af42affd8cbed81cc1b69fa12ddb213f (patch)
tree988d15db6233b20db6a500cd5f590c6d2041462d /drivers/acpi/thermal.c
parentccf2779544eecfcc5447e2028d1029b6d4ff7bb6 (diff)
parent008238b54ac2350babf195084ecedbcf7851a202 (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (179 commits) ACPI: Fix acpi_processor_idle and idle= boot parameters interaction acpi: fix section mismatch warning in pnpacpi intel_menlo: fix build warning ACPI: Cleanup: Remove unneeded, multiple local dummy variables ACPI: video - fix permissions on some proc entries ACPI: video - properly handle errors when registering proc elements ACPI: video - do not store invalid entries in attached_array list ACPI: re-name acpi_pm_ops to acpi_suspend_ops ACER_WMI/ASUS_LAPTOP: fix build bug thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed ACPI: check a return value correctly in acpi_power_get_context() #if 0 acpi/bay.c:eject_removable_drive() eeepc-laptop: add hwmon fan control eeepc-laptop: add backlight eeepc-laptop: add base driver ACPI: thinkpad-acpi: bump up version to 0.20 ACPI: thinkpad-acpi: fix selects in Kconfig ACPI: thinkpad-acpi: use a private workqueue ACPI: thinkpad-acpi: fluff really minor fix ACPI: thinkpad-acpi: use uppercase for "LED" on user documentation ... Fixed conflicts in drivers/acpi/video.c and drivers/misc/intel_menlow.c manually.
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r--drivers/acpi/thermal.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 0815ac3ae3d6..504385b1f211 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -889,10 +889,15 @@ static void acpi_thermal_check(void *data)
889static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) 889static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
890{ 890{
891 struct acpi_thermal *tz = thermal->devdata; 891 struct acpi_thermal *tz = thermal->devdata;
892 int result;
892 893
893 if (!tz) 894 if (!tz)
894 return -EINVAL; 895 return -EINVAL;
895 896
897 result = acpi_thermal_get_temperature(tz);
898 if (result)
899 return result;
900
896 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); 901 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature));
897} 902}
898 903
@@ -1017,6 +1022,18 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
1017 return -EINVAL; 1022 return -EINVAL;
1018} 1023}
1019 1024
1025static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
1026 unsigned long *temperature) {
1027 struct acpi_thermal *tz = thermal->devdata;
1028
1029 if (tz->trips.critical.flags.valid) {
1030 *temperature = KELVIN_TO_MILLICELSIUS(
1031 tz->trips.critical.temperature);
1032 return 0;
1033 } else
1034 return -EINVAL;
1035}
1036
1020typedef int (*cb)(struct thermal_zone_device *, int, 1037typedef int (*cb)(struct thermal_zone_device *, int,
1021 struct thermal_cooling_device *); 1038 struct thermal_cooling_device *);
1022static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, 1039static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
@@ -1108,6 +1125,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = {
1108 .set_mode = thermal_set_mode, 1125 .set_mode = thermal_set_mode,
1109 .get_trip_type = thermal_get_trip_type, 1126 .get_trip_type = thermal_get_trip_type,
1110 .get_trip_temp = thermal_get_trip_temp, 1127 .get_trip_temp = thermal_get_trip_temp,
1128 .get_crit_temp = thermal_get_crit_temp,
1111}; 1129};
1112 1130
1113static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) 1131static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
@@ -1128,7 +1146,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
1128 1146
1129 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && 1147 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
1130 tz->trips.active[i].flags.valid; i++, trips++); 1148 tz->trips.active[i].flags.valid; i++, trips++);
1131 tz->thermal_zone = thermal_zone_device_register("ACPI thermal zone", 1149 tz->thermal_zone = thermal_zone_device_register("acpitz",
1132 trips, tz, &acpi_thermal_zone_ops); 1150 trips, tz, &acpi_thermal_zone_ops);
1133 if (IS_ERR(tz->thermal_zone)) 1151 if (IS_ERR(tz->thermal_zone))
1134 return -ENODEV; 1152 return -ENODEV;