Commit f5b81ddd12da71bd00b2963203c23ff929e0c182

Authored by Lars-Peter Clausen
Committed by Greg Kroah-Hartman
1 parent 493b67b73c

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>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

drivers/iio/industrialio-buffer.c
... ... @@ -285,6 +285,9 @@
285 285 if (channels) {
286 286 /* new magic */
287 287 for (i = 0; i < num_channels; i++) {
  288 + if (channels[i].scan_index < 0)
  289 + continue;
  290 +
288 291 /* Establish necessary mask length */
289 292 if (channels[i].scan_index >
290 293 (int)indio_dev->masklength - 1)