Messages in this thread | | | From | "Rafael J. Wysocki" <> | Date | Tue, 19 Jul 2022 20:18:54 +0200 | Subject | Re: [PATCH v5 08/12] thermal/core: Add thermal_trip in thermal_zone |
| |
On Sun, Jul 10, 2022 at 2:35 PM Daniel Lezcano <daniel.lezcano@linexp.org> wrote: > > The thermal trip points are properties of a thermal zone and the > different sub systems should be able to save them in the thermal zone > structure instead of having their own definition. > > Give the opportunity to the drivers to create a thermal zone with > thermal trips which will be accessible directly from the thermal core > framework. > > Cc: Alexandre Bailon <abailon@baylibre.com> > Cc: Kevin Hilman <khilman@baylibre.com> > Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org> > --- > drivers/thermal/thermal_core.h | 10 ++++++++++ > include/linux/thermal.h | 2 ++ > 2 files changed, 12 insertions(+) > > diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h > index c991bb290512..a4e730391cab 100644 > --- a/drivers/thermal/thermal_core.h > +++ b/drivers/thermal/thermal_core.h > @@ -113,6 +113,16 @@ int thermal_build_list_of_policies(char *buf); > /* Helpers */ > void thermal_zone_set_trips(struct thermal_zone_device *tz); > > +static inline struct thermal_trip *thermal_zone_get_trips(struct thermal_zone_device *tz) > +{ > + return tz->trips; > +} > + > +static inline int thermal_zone_get_num_trips(struct thermal_zone_device *tz) > +{ > + return tz->num_trips; > +}
I'm not sure if these are really useful.
> + > /* sysfs I/F */ > int thermal_zone_create_device_groups(struct thermal_zone_device *, int); > void thermal_zone_destroy_device_groups(struct thermal_zone_device *); > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index 03e968d61471..c7fcb9e2a4fc 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -125,6 +125,7 @@ struct thermal_cooling_device { > * @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis > * @mode: current mode of this thermal zone > * @devdata: private pointer for device private data > + * @trips: an array of struct thermal_trip > * @num_trips: number of trip points the thermal zone supports > * @trips_disabled; bitmap for disabled trips > * @passive_delay_jiffies: number of jiffies to wait between polls when > @@ -165,6 +166,7 @@ struct thermal_zone_device { > struct thermal_attr *trip_hyst_attrs; > enum thermal_device_mode mode; > void *devdata; > + struct thermal_trip *trips;
And I would fold this change into the patch introducing its first user.
> int num_trips; > unsigned long trips_disabled; /* bitmap for disabled trips */ > unsigned long passive_delay_jiffies; > -- > 2.25.1 >
| |