diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-12-19 09:23:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-22 16:38:07 -0500 |
commit | 5fd6218ca5928e4b59eb8a496aa1428fae1fb0d6 (patch) | |
tree | 62f88704e2776c842684c5d3ae0f79636829e185 | |
parent | d4a6882e1b9f01fa5bf7bb695081133121106dbb (diff) |
staging:iio: Disallow changing scan elements in all buffered modes
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>
-rw-r--r-- | drivers/staging/iio/industrialio-buffer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/iio/industrialio-buffer.c b/drivers/staging/iio/industrialio-buffer.c index 36993038b261..747b9013a666 100644 --- a/drivers/staging/iio/industrialio-buffer.c +++ b/drivers/staging/iio/industrialio-buffer.c | |||
@@ -153,7 +153,7 @@ static ssize_t iio_scan_el_store(struct device *dev, | |||
153 | 153 | ||
154 | state = !(buf[0] == '0'); | 154 | state = !(buf[0] == '0'); |
155 | mutex_lock(&indio_dev->mlock); | 155 | mutex_lock(&indio_dev->mlock); |
156 | if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) { | 156 | if (iio_buffer_enabled(indio_dev)) { |
157 | ret = -EBUSY; | 157 | ret = -EBUSY; |
158 | goto error_ret; | 158 | goto error_ret; |
159 | } | 159 | } |
@@ -196,7 +196,7 @@ static ssize_t iio_scan_el_ts_store(struct device *dev, | |||
196 | 196 | ||
197 | state = !(buf[0] == '0'); | 197 | state = !(buf[0] == '0'); |
198 | mutex_lock(&indio_dev->mlock); | 198 | mutex_lock(&indio_dev->mlock); |
199 | if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) { | 199 | if (iio_buffer_enabled(indio_dev)) { |
200 | ret = -EBUSY; | 200 | ret = -EBUSY; |
201 | goto error_ret; | 201 | goto error_ret; |
202 | } | 202 | } |