mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
thermal: of: Match trip property helper types
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. Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/20260831194235.1182138-1-robh@kernel.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
5ad0af4f43
commit
d98d8b50a8
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user