Skip to contentSkip to conversation

hwmon: tmp401: Read "ti,n-factor" as signed

PATCH Applied Rob Herring (Arm) 3 participants 3 messages Jun 12 – Jun 13 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: tmp401: Read "ti,n-factor" as signed

The "ti,n-factor" binding and examples allow negative correction values. Reading it as u32 makes the helper type disagree with the documented signed value and hides real schema mismatches.

Use the signed helper so the DT access matches the s32 value stored by the driver.

Assisted-by Codex:gpt-5-5
---
 drivers/hwmon/tmp401.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/tmp401.c +1 -1
index 07f596581c6e..22ff7c66dca0 100644
@@ -560,7 +560,7 @@ static int tmp401_init_client(struct tmp401_data *data)
 			return ret;
 	}
 
-	ret = of_property_read_u32(data->client->dev.of_node, "ti,n-factor", &nfactor);
+	ret = of_property_read_s32(data->client->dev.of_node, "ti,n-factor", &nfactor);
 	if (!ret) {
 		if (data->kind == tmp401) {
 			dev_err(&data->client->dev, "ti,tmp401 does not support n-factor correction\n");
Signature · 1 line
2.53.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

The "ti,n-factor" binding and examples allow negative correction values. Reading it as u32 makes the helper type disagree with the documented signed value and hides real schema mismatches.

Use the signed helper so the DT access matches the s32 value stored by the driver.

Assisted-by Codex:gpt-5-5

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Applied
#2 lore raw
In reply to Rob Herring (Arm)
Quoted 9 lines · Rob Herring (Arm)

The "ti,n-factor" binding and examples allow negative correction values. Reading it as u32 makes the helper type disagree with the documented signed value and hides real schema mismatches.

Use the signed helper so the DT access matches the s32 value stored by the driver.

Assisted-by Codex:gpt-5-5

Applied.

Thanks,
Guenter