summaryrefslogtreecommitdiff
path: root/drivers/iio/industrialio-trigger.c
diff options
context:
space:
mode:
authorNuno Sá <nuno.sa@analog.com>2022-10-12 18:16:20 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-11-23 22:44:00 +0300
commit16afe125b53f88b855d2713c8ba253d905dcf3cc (patch)
tree4f62505de7510d5194d1fd9c249ccae56db18005 /drivers/iio/industrialio-trigger.c
parent6b701cda3632c9cffaea6f79c5fe638800c8f7f1 (diff)
downloadlinux-16afe125b53f88b855d2713c8ba253d905dcf3cc.tar.xz
iio: core: move 'mlock' to 'struct iio_dev_opaque'
Now that there are no more users accessing 'mlock' directly, we can move it to the iio_dev private structure. Hence, it's now explicit that new driver's should not directly use this lock. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20221012151620.1725215-5-nuno.sa@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/industrialio-trigger.c')
-rw-r--r--drivers/iio/industrialio-trigger.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 6885a186fe27..a2f3cc2f65ef 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -120,12 +120,12 @@ int iio_trigger_set_immutable(struct iio_dev *indio_dev, struct iio_trigger *tri
return -EINVAL;
iio_dev_opaque = to_iio_dev_opaque(indio_dev);
- mutex_lock(&indio_dev->mlock);
+ mutex_lock(&iio_dev_opaque->mlock);
WARN_ON(iio_dev_opaque->trig_readonly);
indio_dev->trig = iio_trigger_get(trig);
iio_dev_opaque->trig_readonly = true;
- mutex_unlock(&indio_dev->mlock);
+ mutex_unlock(&iio_dev_opaque->mlock);
return 0;
}
@@ -438,16 +438,16 @@ static ssize_t current_trigger_store(struct device *dev,
struct iio_trigger *trig;
int ret;
- mutex_lock(&indio_dev->mlock);
+ mutex_lock(&iio_dev_opaque->mlock);
if (iio_dev_opaque->currentmode == INDIO_BUFFER_TRIGGERED) {
- mutex_unlock(&indio_dev->mlock);
+ mutex_unlock(&iio_dev_opaque->mlock);
return -EBUSY;
}
if (iio_dev_opaque->trig_readonly) {
- mutex_unlock(&indio_dev->mlock);
+ mutex_unlock(&iio_dev_opaque->mlock);
return -EPERM;
}
- mutex_unlock(&indio_dev->mlock);
+ mutex_unlock(&iio_dev_opaque->mlock);
trig = iio_trigger_acquire_by_name(buf);
if (oldtrig == trig) {