From: Lars-Peter Clausen Date: Mon, 2 Jul 2012 12:52:56 +0000 (+0200) Subject: iio: iio_buffer_register: Use correct channel when calculating masklength X-Git-Tag: v3.6-rc1~100^2~298^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1dc7bee745f74b42685b4b0b0a24895966e545e;p=platform%2Fkernel%2Flinux-3.10.git iio: iio_buffer_register: Use correct channel when calculating masklength The channel set assigned to the iio device is not necessarily the same has the channel set passed to iio_buffer_register. So to avoid possible complications always work with the channel set pass to iio_buffer_register and ignore the channel set assigned to the iio device. Signed-off-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 3d8d187..096a6bf 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -292,7 +292,7 @@ int iio_buffer_register(struct iio_dev *indio_dev, if (channels[i].scan_index > (int)indio_dev->masklength - 1) indio_dev->masklength - = indio_dev->channels[i].scan_index + 1; + = channels[i].scan_index + 1; ret = iio_buffer_add_channel_sysfs(indio_dev, &channels[i]);