summaryrefslogtreecommitdiff
path: root/drivers/acpi/thermal.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-09-21 20:50:08 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-09-28 13:54:16 +0300
commit54fc61a106c9b7fb55a3c6a595349826c0548468 (patch)
tree68f7d55ab2233a4aa32c8cbfe3962d8c1330d36a /drivers/acpi/thermal.c
parent317508c65f1f966367553ef84f5d8eba16720f32 (diff)
downloadlinux-54fc61a106c9b7fb55a3c6a595349826c0548468.tar.xz
ACPI: thermal: Collapse trip devices update function wrappers
In order to reduce code duplicationeve further, merge acpi_thermal_update_passive/active_devices() into one function called acpi_thermal_update_trip_devices() that will be used for updating both the passive and active trip points. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r--drivers/acpi/thermal.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 93d2ab552686..ebe11288d7e0 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -233,14 +233,16 @@ static bool update_trip_devices(struct acpi_thermal *tz,
return true;
}
-static void acpi_thermal_update_passive_devices(struct acpi_thermal *tz)
+static void acpi_thermal_update_trip_devices(struct acpi_thermal *tz, int index)
{
- struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip;
+ struct acpi_thermal_trip *acpi_trip;
+ acpi_trip = index == ACPI_THERMAL_TRIP_PASSIVE ?
+ &tz->trips.passive.trip : &tz->trips.active[index].trip;
if (!acpi_thermal_trip_valid(acpi_trip))
return;
- if (update_trip_devices(tz, acpi_trip, ACPI_THERMAL_TRIP_PASSIVE, true)) {
+ if (update_trip_devices(tz, acpi_trip, index, true)) {
return;
}
@@ -283,20 +285,6 @@ static void acpi_thermal_update_active_trip(struct acpi_thermal *tz, int index)
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
}
-static void acpi_thermal_update_active_devices(struct acpi_thermal *tz, int index)
-{
- struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;
-
- if (!acpi_thermal_trip_valid(acpi_trip))
- return;
-
- if (update_trip_devices(tz, acpi_trip, index, true))
- return;
-
- acpi_trip->temperature = THERMAL_TEMP_INVALID;
- ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
-}
-
static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data)
{
struct acpi_thermal_trip *acpi_trip = trip->priv;
@@ -324,9 +312,9 @@ static void acpi_thermal_adjust_thermal_zone(struct thermal_zone_device *thermal
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
acpi_thermal_update_active_trip(tz, i);
} else {
- acpi_thermal_update_passive_devices(tz);
+ acpi_thermal_update_trip_devices(tz, ACPI_THERMAL_TRIP_PASSIVE);
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
- acpi_thermal_update_active_devices(tz, i);
+ acpi_thermal_update_trip_devices(tz, i);
}
for_each_thermal_trip(tz->thermal_zone, acpi_thermal_adjust_trip, tz);