diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-02-07 15:38:34 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-04-10 16:21:45 +0100 |
commit | 1234596839ada476b89314bf65f7ab9d422b3721 (patch) | |
tree | 7f9b5c65d1bb133530c8f6e9aea471c22f312455 /drivers/iio/accel | |
parent | 474010127e2505fc463236470908e1ff5ddb3578 (diff) | |
download | linux-1234596839ada476b89314bf65f7ab9d422b3721.tar.bz2 |
iio: st_sensors: Stop abusing mlock to ensure internal coherency
An odr_lock has been introduced to protect local accesses to the odr
internal cache and ensure the cached value always reflected the actual
value. Using the mlock() for this purpose is no longer needed, so let's
drop these extra mutex_lock/unlock() calls.
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20220207143840.707510-8-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/accel')
-rw-r--r-- | drivers/iio/accel/st_accel_core.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index e029589a668a..c8c8eb15c34e 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -1210,8 +1210,6 @@ read_error: static int st_accel_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask) { - int err; - switch (mask) { case IIO_CHAN_INFO_SCALE: { int gain; @@ -1222,10 +1220,8 @@ static int st_accel_write_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_SAMP_FREQ: if (val2) return -EINVAL; - mutex_lock(&indio_dev->mlock); - err = st_sensors_set_odr(indio_dev, val); - mutex_unlock(&indio_dev->mlock); - return err; + + return st_sensors_set_odr(indio_dev, val); default: return -EINVAL; } |