提交 5fd6218c 编写于 作者: L Lars-Peter Clausen 提交者: Greg Kroah-Hartman

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: NJonathan Cameron <jic23@kernel.org>
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 d4a6882e
......@@ -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;
}
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册