[PATCH v2 0/6] thermal: Improve iteration over trip points

From: Rafael J. Wysocki
Date: Tue Oct 03 2023 - 09:27:17 EST


Hi All,

This is a new version of

https://lore.kernel.org/linux-acpi/4871671.31r3eYUQgx@kreacher

which is being posted, because I've realized that the ACPI piece could be
somewhat simpler. Namely, it is not really necessary to store the indices of
active trip points in the ACPI thermal driver (so as to use them to invoke the
appropriate ACPI methods), because they can be readily computed, but IMO it is
better to make changes in more steps in order to use this observation.

This is still true:

It turns out that the notification-handling code in the ACPI thermal driver
can be rearranged to iterate over trip points once, with the help of
for_each_thermal_trip() called directly under the zone lock, so patch [1/6]
adds a helper function for that.

This time, however, more changes are made in order to use this new function in
the ACPI thermal driver:
* One function is relocated (so that the subsequent changes look cleaner)
in patch [2/6].
* Two functions are merged into one (so as to prepare the code for the next
change) in patch [3/4]
* Patch [4/6] changes the ACPI thermal driver to use the function introduced
in patch [1/6] and to reduce the number of trip point walks after a
notification from the platform firmware from 2 to 1.

Next, patch [5/6] drops thermal_zone_device_exec() that is not used any more
and patch [6/6] changes the int340x thermal driver to also use the new helper
to iterate over trip points, so it need not make risky assumptions regarding
the core functionality.

Please see the individual patch changelogs for details.

Thanks!