diff mbox series

[v5,04/30] thermal/core: Add a generic thermal_zone_get_crit_temp() function

Message ID 20220926140604.4173723-5-daniel.lezcano@linaro.org (mailing list archive)
State Superseded, archived
Headers show
Series Rework the trip points creation | expand

Commit Message

Daniel Lezcano Sept. 26, 2022, 2:05 p.m. UTC
The thermal zone ops defines a callback to retrieve the critical
temperature. As the trip handling is being reworked, all the trip
points will be the same whatever the driver and consequently finding
the critical trip temperature will be just a loop to search for a
critical trip point type.

Provide such a generic function, so we encapsulate the ops
get_crit_temp() which can be removed when all the backend drivers are
using the generic trip points handling.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
---
 include/linux/thermal.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rafael J. Wysocki Sept. 26, 2022, 7:27 p.m. UTC | #1
On Mon, Sep 26, 2022 at 4:06 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> The thermal zone ops defines a callback to retrieve the critical
> temperature. As the trip handling is being reworked, all the trip
> points will be the same whatever the driver and consequently finding
> the critical trip temperature will be just a loop to search for a
> critical trip point type.
>
> Provide such a generic function, so we encapsulate the ops
> get_crit_temp() which can be removed when all the backend drivers are
> using the generic trip points handling.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Reviewed-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  include/linux/thermal.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 5350a437f245..66373f872237 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -343,6 +343,8 @@ int thermal_zone_set_trip(struct thermal_zone_device *tz, int trip_id,
>
>  int thermal_zone_get_num_trips(struct thermal_zone_device *tz);
>
> +int thermal_zone_get_crit_temp(struct thermal_zone_device *tz, int *temp);
> +

Well, this only adds a function header which by itself is not
particularly useful (and the code change doesn't match the changelog
even), so I would fold it into the patch that actually adds the
function, including its body.

>  #ifdef CONFIG_THERMAL
>  struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
>                 void *, struct thermal_zone_device_ops *,
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 5350a437f245..66373f872237 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -343,6 +343,8 @@  int thermal_zone_set_trip(struct thermal_zone_device *tz, int trip_id,
 
 int thermal_zone_get_num_trips(struct thermal_zone_device *tz);
 
+int thermal_zone_get_crit_temp(struct thermal_zone_device *tz, int *temp);
+
 #ifdef CONFIG_THERMAL
 struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
 		void *, struct thermal_zone_device_ops *,