mbox series

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

Message ID 4846448.GXAFRqVoOG@kreacher
Headers show
Series thermal: Improve iteration over trip points | expand

Message

Rafael J. Wysocki Oct. 3, 2023, 1:15 p.m. UTC
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!

Comments

Daniel Lezcano Oct. 4, 2023, 4:30 p.m. UTC | #1
On 03/10/2023 15:21, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Combine acpi_thermal_update_passive_trip() and
> acpi_thermal_update_active_trip() into one common function called
> acpi_thermal_update_trip(), so as to reduce code duplication and
> prepare the code in question for subsequent changes.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Rafael J. Wysocki Oct. 5, 2023, 11:04 a.m. UTC | #2
On Wed, Oct 4, 2023 at 6:30 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> On 03/10/2023 15:21, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > Combine acpi_thermal_update_passive_trip() and
> > acpi_thermal_update_active_trip() into one common function called
> > acpi_thermal_update_trip(), so as to reduce code duplication and
> > prepare the code in question for subsequent changes.
> >
> > No intentional functional impact.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
>
> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Thanks for all of the reviews, much appreciated!

I'm going to apply the series now unless you have strong objections
against any of the remaining patches [4,6/6].

Cheers!
Daniel Lezcano Oct. 5, 2023, 11:20 a.m. UTC | #3
On 03/10/2023 15:26, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Modify int340x_thermal_update_trips() to use thermal_zone_for_each_trip()
> for walking trips instead of using the trips[] table passed to the
> thermal zone registration function.
> 
> For this purpose, store active trip point indices in the priv fieids of
> the corresponding thermal_trip structures.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> v1 -> v2: Mo changes
> 
> ---

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>