瀏覽代碼

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>
Lars-Peter Clausen 13 年之前
父節點
當前提交
f5b81ddd12
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/iio/industrialio-buffer.c

+ 3 - 0
drivers/iio/industrialio-buffer.c

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