Skip to content

Commit 54fc61a

Browse files
committed
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 <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
1 parent 317508c commit 54fc61a

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

drivers/acpi/thermal.c

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,16 @@ static bool update_trip_devices(struct acpi_thermal *tz,
233233
return true;
234234
}
235235

236-
static void acpi_thermal_update_passive_devices(struct acpi_thermal *tz)
236+
static void acpi_thermal_update_trip_devices(struct acpi_thermal *tz, int index)
237237
{
238-
struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip;
238+
struct acpi_thermal_trip *acpi_trip;
239239

240+
acpi_trip = index == ACPI_THERMAL_TRIP_PASSIVE ?
241+
&tz->trips.passive.trip : &tz->trips.active[index].trip;
240242
if (!acpi_thermal_trip_valid(acpi_trip))
241243
return;
242244

243-
if (update_trip_devices(tz, acpi_trip, ACPI_THERMAL_TRIP_PASSIVE, true)) {
245+
if (update_trip_devices(tz, acpi_trip, index, true)) {
244246
return;
245247
}
246248

@@ -283,20 +285,6 @@ static void acpi_thermal_update_active_trip(struct acpi_thermal *tz, int index)
283285
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
284286
}
285287

286-
static void acpi_thermal_update_active_devices(struct acpi_thermal *tz, int index)
287-
{
288-
struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;
289-
290-
if (!acpi_thermal_trip_valid(acpi_trip))
291-
return;
292-
293-
if (update_trip_devices(tz, acpi_trip, index, true))
294-
return;
295-
296-
acpi_trip->temperature = THERMAL_TEMP_INVALID;
297-
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
298-
}
299-
300288
static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data)
301289
{
302290
struct acpi_thermal_trip *acpi_trip = trip->priv;
@@ -324,9 +312,9 @@ static void acpi_thermal_adjust_thermal_zone(struct thermal_zone_device *thermal
324312
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
325313
acpi_thermal_update_active_trip(tz, i);
326314
} else {
327-
acpi_thermal_update_passive_devices(tz);
315+
acpi_thermal_update_trip_devices(tz, ACPI_THERMAL_TRIP_PASSIVE);
328316
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
329-
acpi_thermal_update_active_devices(tz, i);
317+
acpi_thermal_update_trip_devices(tz, i);
330318
}
331319

332320
for_each_thermal_trip(tz->thermal_zone, acpi_thermal_adjust_trip, tz);

0 commit comments

Comments
 (0)