[PATCH] hwmon: (scmi) Enable temperature sensors using their sensor IDs

From: raoxu

Date: Mon Nov 09 2026 - 03:32:09 EST


From: Xu Rao <raoxu@xxxxxxxxxxxxx>

scmi_hwmon_probe() groups sensors by hwmon type, so the index in
scmi_sensors->info[hwmon_temp] is not necessarily the SCMI sensor ID.
Passing that index to config_set() targets a different sensor if the
platform exposes non-temperature sensors ahead of temperature sensors.
The intended temperature sensor can remain disabled, causing subsequent
readings to fail. If configuring the wrong sensor fails, thermal
registration of the intended sensor is also skipped.

Use the firmware sensor ID, as the read and thermal registration paths
already do, so temperature sensors are enabled correctly.

The patch was reviewed and the commit message expanded with OpenCode
AI assistance.

Fixes: 72804d1631b3 ("hwmon: (scmi) Enable sensors to assure they can be read")
Signed-off-by: Xu Rao <raoxu@xxxxxxxxxxxxx>
---
drivers/hwmon/scmi-hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
index 9ae8f774297e..6a9895697f3c 100644
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -342,7 +342,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
if (!sensor)
continue;

- ret = sensor_ops->config_set(ph, i, sensor_config);
+ ret = sensor_ops->config_set(ph, sensor->id, sensor_config);
if (ret) {
dev_err(dev, "Error enabling sensor %s. err=%d\n",
sensor->name, ret);
--
2.50.1