[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251218-mprls_cleanup-v1-2-b36a170f1a5c@subdimension.ro>
Date: Thu, 18 Dec 2025 13:05:44 +0200
From: Petre Rodan <petre.rodan@...dimension.ro>
To: Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Andreas Klinger <ak@...klinger.de>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: [PATCH 02/14] iio: pressure: mprls0025pa: remove redundant mutex
Remove the redundant mutex since both i2c and spi transfer functions
provide their own locking mechanism.
Signed-off-by: Petre Rodan <petre.rodan@...dimension.ro>
---
drivers/iio/pressure/mprls0025pa.c | 6 ------
drivers/iio/pressure/mprls0025pa.h | 3 ---
2 files changed, 9 deletions(-)
diff --git a/drivers/iio/pressure/mprls0025pa.c b/drivers/iio/pressure/mprls0025pa.c
index 2336f2760eae..d3e76eed07e6 100644
--- a/drivers/iio/pressure/mprls0025pa.c
+++ b/drivers/iio/pressure/mprls0025pa.c
@@ -188,7 +188,6 @@ static void mpr_reset(struct mpr_data *data)
* If there is an end of conversion (EOC) interrupt registered the function
* waits for a maximum of one second for the interrupt.
*
- * Context: The function can sleep and data->lock should be held when calling it
* Return:
* * 0 - OK, the pressure value could be read
* * -ETIMEDOUT - Timeout while waiting for the EOC interrupt or busy flag is
@@ -273,7 +272,6 @@ static irqreturn_t mpr_trigger_handler(int irq, void *p)
struct iio_dev *indio_dev = pf->indio_dev;
struct mpr_data *data = iio_priv(indio_dev);
- mutex_lock(&data->lock);
ret = mpr_read_pressure(data, &data->chan.pres);
if (ret < 0)
goto err;
@@ -282,7 +280,6 @@ static irqreturn_t mpr_trigger_handler(int irq, void *p)
iio_get_time_ns(indio_dev));
err:
- mutex_unlock(&data->lock);
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
@@ -300,9 +297,7 @@ static int mpr_read_raw(struct iio_dev *indio_dev,
switch (mask) {
case IIO_CHAN_INFO_RAW:
- mutex_lock(&data->lock);
ret = mpr_read_pressure(data, &pressure);
- mutex_unlock(&data->lock);
if (ret < 0)
return ret;
*val = pressure;
@@ -342,7 +337,6 @@ int mpr_common_probe(struct device *dev, const struct mpr_ops *ops, int irq)
data->ops = ops;
data->irq = irq;
- mutex_init(&data->lock);
init_completion(&data->completion);
indio_dev->name = "mprls0025pa";
diff --git a/drivers/iio/pressure/mprls0025pa.h b/drivers/iio/pressure/mprls0025pa.h
index d62a018eaff3..d38ac750e392 100644
--- a/drivers/iio/pressure/mprls0025pa.h
+++ b/drivers/iio/pressure/mprls0025pa.h
@@ -14,7 +14,6 @@
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/device.h>
-#include <linux/mutex.h>
#include <linux/stddef.h>
#include <linux/types.h>
@@ -44,7 +43,6 @@ enum mpr_func_id {
* struct mpr_data
* @dev: current device structure
* @ops: functions that implement the sensor reads/writes, bus init
- * @lock: access to device during read
* @pmin: minimal pressure in pascal
* @pmax: maximal pressure in pascal
* @function: transfer function
@@ -66,7 +64,6 @@ enum mpr_func_id {
struct mpr_data {
struct device *dev;
const struct mpr_ops *ops;
- struct mutex lock;
u32 pmin;
u32 pmax;
enum mpr_func_id function;
--
2.51.2
Powered by blists - more mailing lists