summaryrefslogtreecommitdiff
path: root/drivers/thermal/intel/int340x_thermal
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-01-27 19:17:03 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-02-02 15:26:45 +0100
commitdd3b3d160ea7004091051da60e86f36f40970888 (patch)
tree43a6e5c08142b92c016561fa59839d66e2013234 /drivers/thermal/intel/int340x_thermal
parentf4118dbe61bb30038ca7f3ecaf333cabc9c54141 (diff)
thermal: ACPI: Make helpers retrieve temperature only
It is slightly better to make the ACPI thermal helper functions retrieve the trip point temperature only instead of doing the full trip point initialization, because they are also used for updating some already registered trip points, in which case initializing a new trip just in order to update the temperature of an existing one is somewhat wasteful. Modify the ACPI thermal helpers accordingly and update their users. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/thermal/intel/int340x_thermal')
-rw-r--r--drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
index 09b1b51eb6a5..a675f79f792b 100644
--- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
+++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
@@ -70,24 +70,35 @@ static int int340x_thermal_read_trips(struct acpi_device *zone_adev,
{
int i, ret;
- ret = thermal_acpi_trip_critical(zone_adev, &zone_trips[trip_cnt]);
- if (!ret)
+ ret = thermal_acpi_critical_trip_temp(zone_adev,
+ &zone_trips[trip_cnt].temperature);
+ if (!ret) {
+ zone_trips[trip_cnt].type = THERMAL_TRIP_CRITICAL;
trip_cnt++;
+ }
- ret = thermal_acpi_trip_hot(zone_adev, &zone_trips[trip_cnt]);
- if (!ret)
+ ret = thermal_acpi_hot_trip_temp(zone_adev,
+ &zone_trips[trip_cnt].temperature);
+ if (!ret) {
+ zone_trips[trip_cnt].type = THERMAL_TRIP_HOT;
trip_cnt++;
+ }
- ret = thermal_acpi_trip_passive(zone_adev, &zone_trips[trip_cnt]);
- if (!ret)
+ ret = thermal_acpi_passive_trip_temp(zone_adev,
+ &zone_trips[trip_cnt].temperature);
+ if (!ret) {
+ zone_trips[trip_cnt].type = THERMAL_TRIP_PASSIVE;
trip_cnt++;
+ }
for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT; i++) {
- ret = thermal_acpi_trip_active(zone_adev, i, &zone_trips[trip_cnt]);
+ ret = thermal_acpi_active_trip_temp(zone_adev, i,
+ &zone_trips[trip_cnt].temperature);
if (ret)
break;
+ zone_trips[trip_cnt].type = THERMAL_TRIP_ACTIVE;
trip_cnt++;
}
@@ -213,22 +224,21 @@ void int340x_thermal_update_trips(struct int34x_thermal_zone *int34x_zone)
mutex_lock(&int34x_zone->zone->lock);
for (i = int34x_zone->aux_trip_nr; i < trip_cnt; i++) {
- struct thermal_trip trip;
- int err;
+ int temp, err;
switch (zone_trips[i].type) {
case THERMAL_TRIP_CRITICAL:
- err = thermal_acpi_trip_critical(zone_adev, &trip);
+ err = thermal_acpi_critical_trip_temp(zone_adev, &temp);
break;
case THERMAL_TRIP_HOT:
- err = thermal_acpi_trip_hot(zone_adev, &trip);
+ err = thermal_acpi_hot_trip_temp(zone_adev, &temp);
break;
case THERMAL_TRIP_PASSIVE:
- err = thermal_acpi_trip_passive(zone_adev, &trip);
+ err = thermal_acpi_passive_trip_temp(zone_adev, &temp);
break;
case THERMAL_TRIP_ACTIVE:
- err = thermal_acpi_trip_active(zone_adev, act_trip_nr++,
- &trip);
+ err = thermal_acpi_active_trip_temp(zone_adev, act_trip_nr++,
+ &temp);
break;
default:
err = -ENODEV;
@@ -238,7 +248,7 @@ void int340x_thermal_update_trips(struct int34x_thermal_zone *int34x_zone)
continue;
}
- zone_trips[i].temperature = trip.temperature;
+ zone_trips[i].temperature = temp;
}
mutex_unlock(&int34x_zone->zone->lock);