aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen2013-10-04 12:07:00 +0100
committerJonathan Cameron2013-10-12 13:06:31 +0100
commit3909fab5a8afdf8f0c9191e3a2660230ef0ef724 (patch)
tree9ed0d4b5d28572ad1178eaa15d7528286883cc28 /drivers/iio
parentec87197fb8518ce3f95a96d66355d01d83376617 (diff)
iio:buffer: Ignore noop requests for iio_update_buffers()
Since the kernel now disables all buffers when a device is unregistered it might happen that a in-kernel consumer tries to disable that buffer again. So ignore requests where the buffer already is in the desired state. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/industrialio-buffer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index d12b384d94bf..796376ac2475 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -664,9 +664,23 @@ int iio_update_buffers(struct iio_dev *indio_dev,
{
int ret;
+ if (insert_buffer == remove_buffer)
+ return 0;
+
mutex_lock(&indio_dev->info_exist_lock);
mutex_lock(&indio_dev->mlock);
+ if (insert_buffer && iio_buffer_is_active(insert_buffer))
+ insert_buffer = NULL;
+
+ if (remove_buffer && !iio_buffer_is_active(remove_buffer))
+ remove_buffer = NULL;
+
+ if (!insert_buffer && !remove_buffer) {
+ ret = 0;
+ goto out_unlock;
+ }
+
if (indio_dev->info == NULL) {
ret = -ENODEV;
goto out_unlock;