[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jfUKFo-MDVU7i+yvfk=f_65Unat6715S6kuqvRX9eQLA@mail.gmail.com>
Date: Thu, 8 Feb 2024 20:25:43 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Stanislaw Gruszka <stanislaw.gruszka@...ux.intel.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>, Linux PM <linux-pm@...r.kernel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>, LKML <linux-kernel@...r.kernel.org>,
Linux ACPI <linux-acpi@...r.kernel.org>, Lukasz Luba <lukasz.luba@....com>,
Zhang Rui <rui.zhang@...el.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Subject: Re: [PATCH v1 1/6] thermal: core: Store zone trips table in struct thermal_zone_device
On Thu, Feb 8, 2024 at 9:22 AM Stanislaw Gruszka
<stanislaw.gruszka@...ux.intel.com> wrote:
>
> On Mon, Feb 05, 2024 at 10:14:31PM +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> >
> > The current code requires thermal zone creators to pass a pointer to a
> > writable trips table to thermal_zone_device_register_with_trips() and
> > that trips table is then used by the thermal core going forward.
> >
> > Consequently, the callers of thermal_zone_device_register_with_trips()
> > are required to hold on to the trips table passed to it until the given
> > thermal zone is unregistered, at which point the trips table can be
> > freed, but at the same time they are not allowed to access the cells in
> > that table directly. This is both error prone and confusing.
> >
> > To address it, turn the trips table pointer in struct thermal_zone_device
> > into a flex array (counted by its num_trips field), allocate it during
> > thermal zone device allocation and copy the contents of the trips table
> > supplied by the zone creator (which can be const now) into it.
> >
> > This allows the callers of thermal_zone_device_register_with_trips() to
> > drop their trip tables right after the zone registration.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@...ux.intel.com>
Thanks a lot for all of the reviews, much appreciated, especially
regarding the Intel drivers changes.
Unfortunately, this patch series, and the first half of it in
particular, is somewhat premature, because a couple of thermal drivers
do unexpected things to their trip point tables and they need to be
modified to stop accessing the trip tables directly before the core
can start using internal copies of them.
I'm going to save the tags for the future, however.
Powered by blists - more mailing lists