[PATCH v3 7/8] hwmon: Add mutex protecting for sbtsi read/write through hwmon

From: Akshay Gupta

Date: Mon Jun 22 2026 - 10:09:05 EST


From: Prathima <Prathima.Lk@xxxxxxx>

Add a mutex and take it around SBTSI read/write paths so that only
one transaction runs at a time. The lock is held only for the
duration of the bus transfer and associated driver bookkeeping, not
across blocking work unrelated to SBTSI.

This is a concurrency hardening fix.

Reviewed-by: Akshay Gupta <Akshay.Gupta@xxxxxxx>
Signed-off-by: Prathima <Prathima.Lk@xxxxxxx>
---
Changes since v2:
- New patch

drivers/hwmon/sbtsi_temp.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/sbtsi_temp.c b/drivers/hwmon/sbtsi_temp.c
index d7ae986d824c..11c8108d69b2 100644
--- a/drivers/hwmon/sbtsi_temp.c
+++ b/drivers/hwmon/sbtsi_temp.c
@@ -70,6 +70,7 @@ static int sbtsi_temp_read(struct sbtsi_data *data, u8 reg1, u8 reg2,
{
int ret;

+ guard(sbtsi)(data);
ret = sbtsi_xfer(data, reg1, val1, true);
if (!ret)
ret = sbtsi_xfer(data, reg2, val2, true);
@@ -84,6 +85,7 @@ static int sbtsi_temp_write(struct sbtsi_data *data, u8 reg_int, u8 reg_dec,
{
int ret;

+ guard(sbtsi)(data);
ret = sbtsi_xfer(data, reg_int, &val_int, false);
if (!ret)
ret = sbtsi_xfer(data, reg_dec, &val_dec, false);
--
2.34.1