From: Lars-Peter Clausen Date: Mon, 18 Jun 2012 16:33:47 +0000 (+0200) Subject: iio: iio_buffer_register: Skip channels with negative scan index X-Git-Tag: next-20120724~21^2~710 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f5b81ddd12da71bd00b2963203c23ff929e0c182;p=karo-tx-linux.git 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 Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 2f35db93cdb6..3d8d187eef2a 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)