Skip to content

Commit

Permalink
staging:iio: Disallow changing scan elements in all buffered modes
Browse files Browse the repository at this point in the history
Currently we only disallow changing the scan elements, while the buffer is
enabled, in triggered buffer mode. This patch changes it to disallow it for all
buffered modes. Disabling or enabling scan elements while the buffer is enabled
will cause undefined behavior since the reader will not be able to tell samples
with the new and old scan element set apart and thus wont be able to extract
any meaningful data from the buffer.

Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Lars-Peter Clausen authored and Greg Kroah-Hartman committed Dec 22, 2011
1 parent d4a6882 commit 5fd6218
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static ssize_t iio_scan_el_store(struct device *dev,

state = !(buf[0] == '0');
mutex_lock(&indio_dev->mlock);
if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
if (iio_buffer_enabled(indio_dev)) {
ret = -EBUSY;
goto error_ret;
}
Expand Down Expand Up @@ -196,7 +196,7 @@ static ssize_t iio_scan_el_ts_store(struct device *dev,

state = !(buf[0] == '0');
mutex_lock(&indio_dev->mlock);
if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) {
if (iio_buffer_enabled(indio_dev)) {
ret = -EBUSY;
goto error_ret;
}
Expand Down

0 comments on commit 5fd6218

Please sign in to comment.