Skip to content

Commit

Permalink
thermal: add new get_crit_temp callback
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jean Delvare <[email protected]>
Signed-off-by: Len Brown <[email protected]>
  • Loading branch information
zhang-rui authored and lenb committed Apr 29, 2008
1 parent 63c4ec9 commit 9ec732f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/acpi/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions include/linux/thermal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9ec732f

Please sign in to comment.