Re: [PATCH] thermal: of: Match trip property helper types

Rob Herring <[email protected]>
Newsgroups org.kernel.vger.linux-pm,org.kernel.vger.linux-kernel
Message-ID <CAL_Jsq+zBQrAf0oRrJ178X9UDum1gsbpUKgMsyiPsPZZyXZDBA@mail.gmail.com>
On Fri, Jun 12, 2026 at 4:50 PM Rob Herring (Arm) <[email protected]> wrote:
>
> The thermal-zone binding defines "temperature" as a signed int32
> value and "hysteresis" as an unsigned int32 value. Using helpers with
> matching types avoids dt_property_check mismatches and preserves the
> signed interpretation needed for trips below zero.
>
> Read "temperature" with the signed helper and keep "hysteresis" on the
> unsigned helper using separate typed temporaries before storing them in
> the trip structure.
>
> Assisted-by: Codex:gpt-5-5
> Signed-off-by: Rob Herring (Arm) <[email protected]>
> ---
>  drivers/thermal/thermal_of.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Ping

>
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 99085c806a1f..196cb29afae9 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -63,22 +63,23 @@ static int thermal_of_get_trip_type(struct device_node *np,
>  static int thermal_of_populate_trip(struct device_node *np,
>                                     struct thermal_trip *trip)
>  {
> -       int prop;
> +       u32 hysteresis;
> +       s32 temperature;
>         int ret;
>
> -       ret = of_property_read_u32(np, "temperature", &prop);
> +       ret = of_property_read_s32(np, "temperature", &temperature);
>         if (ret < 0) {
>                 pr_err("missing temperature property\n");
>                 return ret;
>         }
> -       trip->temperature = prop;
> +       trip->temperature = temperature;
>
> -       ret = of_property_read_u32(np, "hysteresis", &prop);
> +       ret = of_property_read_u32(np, "hysteresis", &hysteresis);
>         if (ret < 0) {
>                 pr_err("missing hysteresis property\n");
>                 return ret;
>         }
> -       trip->hysteresis = prop;
> +       trip->hysteresis = hysteresis;
>
>         ret = thermal_of_get_trip_type(np, &trip->type);
>         if (ret < 0) {
> --
> 2.53.0
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.