mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
hwmon: Add mutex protecting for sbtsi read/write through hwmon
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@amd.com> Signed-off-by: Prathima <Prathima.Lk@amd.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://patch.msgid.link/20260710111642.850022-8-Akshay.Gupta@amd.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
48ad55cda0
commit
47f6311f8f
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user