]> Git Repo - linux.git/commitdiff
hwmon: (da9052) Synchronize access with mfd
authorSamu Nuutamo <[email protected]>
Mon, 11 May 2020 11:02:19 +0000 (13:02 +0200)
committerGuenter Roeck <[email protected]>
Wed, 13 May 2020 17:06:09 +0000 (10:06 -0700)
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: 4f16cab19a3d5 ("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]>
drivers/hwmon/da9052-hwmon.c

index 53b517dbe7e6ecaffab8c2a85053f82bc5caaf55..4af2fc309c28689ff4214f186fc3b27a38dad2c8 100644 (file)
@@ -244,9 +244,9 @@ static ssize_t da9052_tsi_show(struct device *dev,
        int channel = to_sensor_dev_attr(devattr)->index;
        int ret;
 
-       mutex_lock(&hwmon->hwmon_lock);
+       mutex_lock(&hwmon->da9052->auxadc_lock);
        ret = __da9052_read_tsi(dev, channel);
-       mutex_unlock(&hwmon->hwmon_lock);
+       mutex_unlock(&hwmon->da9052->auxadc_lock);
 
        if (ret < 0)
                return ret;
This page took 0.055476 seconds and 4 git commands to generate.