* [RESEND PATCH] thermal: of: Match trip property helper types
@ 2026-08-31 19:42 Rob Herring (Arm)
2026-09-07 7:45 ` Lukasz Luba
0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring (Arm) @ 2026-08-31 19:42 UTC (permalink / raw)
To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba
Cc: linux-pm, linux-kernel
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) <robh@kernel.org>
---
drivers/thermal/thermal_of.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
index 0217a49b08ae..deaae7a995c5 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH] thermal: of: Match trip property helper types
2026-08-31 19:42 [RESEND PATCH] thermal: of: Match trip property helper types Rob Herring (Arm)
@ 2026-09-07 7:45 ` Lukasz Luba
2026-09-10 18:15 ` Rafael J. Wysocki (Intel)
0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Luba @ 2026-09-07 7:45 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: linux-pm, Zhang Rui, linux-kernel, Daniel Lezcano,
Rafael J. Wysocki
Hi Rob,
On 8/31/26 20:42, Rob Herring (Arm) 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) <robh@kernel.org>
> ---
> drivers/thermal/thermal_of.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
I can see you've missed my previous tag, here it is:
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH] thermal: of: Match trip property helper types
2026-09-07 7:45 ` Lukasz Luba
@ 2026-09-10 18:15 ` Rafael J. Wysocki (Intel)
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-09-10 18:15 UTC (permalink / raw)
To: Lukasz Luba, Rob Herring (Arm)
Cc: linux-pm, Zhang Rui, linux-kernel, Daniel Lezcano
On Mon, Sep 7, 2026 at 9:45 AM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
> Hi Rob,
>
> On 8/31/26 20:42, Rob Herring (Arm) 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) <robh@kernel.org>
> > ---
> > drivers/thermal/thermal_of.c | 11 ++++++-----
> > 1 file changed, 6 insertions(+), 5 deletions(-)
> >
>
>
> I can see you've missed my previous tag, here it is:
>
> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Applied as 7.4 material, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-10 18:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 19:42 [RESEND PATCH] thermal: of: Match trip property helper types Rob Herring (Arm)
2026-09-07 7:45 ` Lukasz Luba
2026-09-10 18:15 ` Rafael J. Wysocki (Intel)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox