dect
/
linux-2.6
Archived
13
0
Fork 0

iio: iio_buffer_register: Skip channels with negative scan index

It is not always the case that all channels can be used in buffered mode. This
patch allows channels, which can not be used in buffered mode, to set their scan
index to a negative number, which will cause iio_buffer_register to ignore the
channel.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Lars-Peter Clausen 2012-06-18 18:33:47 +02:00 committed by Greg Kroah-Hartman
parent 493b67b73c
commit f5b81ddd12
1 changed files with 3 additions and 0 deletions

View File

@ -285,6 +285,9 @@ int iio_buffer_register(struct iio_dev *indio_dev,
if (channels) {
/* new magic */
for (i = 0; i < num_channels; i++) {
if (channels[i].scan_index < 0)
continue;
/* Establish necessary mask length */
if (channels[i].scan_index >
(int)indio_dev->masklength - 1)