power: supply: Match DT value types

The battery drivers read properties whose bindings use signed values
for temperature thresholds and unsigned values for voltage thresholds.
Some helpers used the opposite signedness, which makes property type
checking report real mismatches.

Use signed helpers where the binding and DTS allow negative values, and
use unsigned helpers for voltage properties documented as uint32 cells.

Assisted-by: Codex:gpt-5-5
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260612215308.1888834-1-robh@kernel.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
Rob Herring (Arm)
2026-06-12 16:53:07 -05:00
committed by Sebastian Reichel
parent 5a6b9c36c5
commit 6a3b47a5a5
2 changed files with 7 additions and 3 deletions

View File

@@ -463,7 +463,7 @@ static int ltc294x_i2c_probe(struct i2c_client *client)
/* r_sense can be negative, when sense+ is connected to the battery
* instead of the sense-. This results in reversed measurements. */
ret = of_property_read_u32(np, "lltc,resistor-sense", &r_sense);
ret = of_property_read_s32(np, "lltc,resistor-sense", &r_sense);
if (ret < 0)
return dev_err_probe(&client->dev, ret,
"Could not find lltc,resistor-sense in devicetree\n");

View File

@@ -1027,10 +1027,14 @@ static int max17042_parse_dt(struct max17042_chip *chip)
chip->temp_min = INT_MIN;
if (of_property_read_s32(np, "maxim,over-heat-temp", &chip->temp_max))
chip->temp_max = INT_MAX;
if (of_property_read_s32(np, "maxim,dead-volt", &chip->vmin))
if (of_property_read_u32(np, "maxim,dead-volt", &prop))
chip->vmin = INT_MIN;
if (of_property_read_s32(np, "maxim,over-volt", &chip->vmax))
else
chip->vmin = prop;
if (of_property_read_u32(np, "maxim,over-volt", &prop))
chip->vmax = INT_MAX;
else
chip->vmin = prop;
return 0;
}