]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: chemical: bme680: Fix read/write ops to device by adding mutexes
authorVasileios Amoiridis <vassilisamir@gmail.com>
Sun, 9 Jun 2024 23:38:12 +0000 (01:38 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 3 Aug 2024 09:13:34 +0000 (10:13 +0100)
commit77641e5a477d428335cd094b88ac54e09ccb70f4
tree63edacbeb54bd2aecf8877b334cd1f996c1d19ae
parent7d34b4ad8cd2867b130b5b8d7d76d0d6092bd019
iio: chemical: bme680: Fix read/write ops to device by adding mutexes

Add mutexes in the {read/write}_raw() functions of the device to guard the
read/write of data from/to the device. This is necessary because for any
operation other than temperature, multiple reads need to take place from
the device. Even though regmap has a locking by itself, it won't protect us
from multiple applications trying to read at the same time temperature and
pressure since the pressure reading includes an internal temperature
reading and there is nothing to ensure that this temperature+pressure
reading will happen sequentially without any other operation interfering
in the meantime.

Fixes: 1b3bd8592780 ("iio: chemical: Add support for Bosch BME680 sensor")
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20240609233826.330516-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/chemical/bme680_core.c