Skip to content

Commit 333e22d

Browse files
Samu Nuutamogroeck
authored andcommitted
hwmon: (da9052) Synchronize access with mfd
When tsi-as-adc is configured it is possible for in7[0123]_input read to return an incorrect value if a concurrent read to in[456]_input is performed. This is caused by a concurrent manipulation of the mux channel without proper locking as hwmon and mfd use different locks for synchronization. Switch hwmon to use the same lock as mfd when accessing the TSI channel. Fixes: 4f16cab ("hwmon: da9052: Add support for TSI channel") Signed-off-by: Samu Nuutamo <[email protected]> [rebase to current master, reword commit message slightly] Signed-off-by: Sebastian Reichel <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent 7b2fd27 commit 333e22d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hwmon/da9052-hwmon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ static ssize_t da9052_tsi_show(struct device *dev,
244244
int channel = to_sensor_dev_attr(devattr)->index;
245245
int ret;
246246

247-
mutex_lock(&hwmon->hwmon_lock);
247+
mutex_lock(&hwmon->da9052->auxadc_lock);
248248
ret = __da9052_read_tsi(dev, channel);
249-
mutex_unlock(&hwmon->hwmon_lock);
249+
mutex_unlock(&hwmon->da9052->auxadc_lock);
250250

251251
if (ret < 0)
252252
return ret;

0 commit comments

Comments
 (0)