From: Zhang, Rui Date: Thu, 10 Apr 2008 08:13:10 +0000 (+0800) Subject: thermal: add new get_crit_temp callback X-Git-Tag: v2.6.26-rc1~101^2~1^11~6 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=9ec732ff80b7e8a9096666f78ae584d3b393bc84;p=~shefty%2Frdma-dev.git thermal: add new get_crit_temp callback Add a new callback so that the generic thermal can get the critical trip point info of a thermal zone, which is needed for building the tempX_crit hwmon sysfs attribute. Signed-off-by: Zhang Rui Acked-by: Jean Delvare Signed-off-by: Len Brown --- diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 766bd25d337..ec707ed1a70 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -1012,6 +1012,18 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, return -EINVAL; } +static int thermal_get_crit_temp(struct thermal_zone_device *thermal, + unsigned long *temperature) { + struct acpi_thermal *tz = thermal->devdata; + + if (tz->trips.critical.flags.valid) { + *temperature = KELVIN_TO_MILLICELSIUS( + tz->trips.critical.temperature); + return 0; + } else + return -EINVAL; +} + typedef int (*cb)(struct thermal_zone_device *, int, struct thermal_cooling_device *); static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, @@ -1103,6 +1115,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { .set_mode = thermal_set_mode, .get_trip_type = thermal_get_trip_type, .get_trip_temp = thermal_get_trip_temp, + .get_crit_temp = thermal_get_crit_temp, }; static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 3ff680b44e8..16e6a8bdeb3 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -41,6 +41,7 @@ struct thermal_zone_device_ops { int (*set_mode) (struct thermal_zone_device *, const char *); int (*get_trip_type) (struct thermal_zone_device *, int, char *); int (*get_trip_temp) (struct thermal_zone_device *, int, char *); + int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); }; struct thermal_cooling_device_ops {