Re: [PATCH v2 16/16] thermal/traces: Replace the thermal zone structure parameter with the field value
From: Rafael J. Wysocki
Date: Wed Feb 22 2023 - 15:08:16 EST
On Wed, Feb 22, 2023 at 9:02 PM Daniel Lezcano
<daniel.lezcano@xxxxxxxxxx> wrote:
>
> On 22/02/2023 20:51, Rafael J. Wysocki wrote:
> > On Tue, Feb 21, 2023 at 7:08 PM Daniel Lezcano
> > <daniel.lezcano@xxxxxxxxxx> wrote:
> >>
> >> In the work of the thermal zone device self-encapsulation, let's pass
> >> the field value instead of dereferencing them in the traces which
> >> force us to export publicly the thermal_zone_device structure.
> >>
> >> No fonctionnal change intended.
> >>
> >> Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
> >> ---
> >> drivers/thermal/gov_fair_share.c | 2 +-
> >> drivers/thermal/gov_power_allocator.c | 4 ++--
> >> drivers/thermal/gov_step_wise.c | 2 +-
> >> drivers/thermal/thermal_core.c | 5 ++--
> >> include/trace/events/thermal.h | 24 +++++++++----------
> >> .../trace/events/thermal_power_allocator.h | 12 +++++-----
> >> 6 files changed, 25 insertions(+), 24 deletions(-)
> >>
> >> diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_share.c
> >> index aad7d5fe3a14..e6c21abaaa80 100644
> >> --- a/drivers/thermal/gov_fair_share.c
> >> +++ b/drivers/thermal/gov_fair_share.c
> >> @@ -35,7 +35,7 @@ static int get_trip_level(struct thermal_zone_device *tz)
> >> * point, in which case, trip_point = count - 1
> >> */
> >> if (count > 0)
> >> - trace_thermal_zone_trip(tz, count - 1, trip.type);
> >> + trace_thermal_zone_trip(tz->type, tz->id, count - 1, trip.type);
> >
> > Haven't you introduced an accessor for tz->id in this series? Why not
> > use it here?
> >
> > And there can be an analogous accessor for tz->type.
> >
> > If there are accessors like that, they should be used consistently
> > everywhere as applicable IMO.
>
> governors are part of the thermal core code, so they are authorized to
> access the thermal structure internals, that is why they are not passing
> through the accessors.
I'm not talking about "authorization", but about consistency.
If accessors are used consistently, it is sufficient to grep for an
accessor to find all places where the given field is accessed, for
example.