[PATCH 01/10] iio: iio_buffer_register: Skip channels with negative scan index

Lars-Peter Clausen lars at metafoo.de
Mon Jun 18 16:33:47 UTC 2012


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 at metafoo.de>
Acked-by: Jonathan Cameron <jic23 at kernel.org>
---
 drivers/iio/industrialio-buffer.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 2f35db9..3d8d187 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -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)
-- 
1.7.10




More information about the devel mailing list