summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Reid <preid@electromag.com.au>2016-06-27 05:17:56 +0200
committerJonathan Cameron <jic23@kernel.org>2016-06-27 22:06:40 +0200
commit29e3e06d893105febb9c9ccaff856fcdcbe3f712 (patch)
tree6c4056d7eb63d815ae274afdd9f59e483ee0ac7d
parentiio: adc: max1363: Fix missing i2c_device_id for MAX1164x parts (diff)
downloadlinux-29e3e06d893105febb9c9ccaff856fcdcbe3f712.tar.xz
linux-29e3e06d893105febb9c9ccaff856fcdcbe3f712.zip
iio: buffer-dma: Use ARRAY_SIZE in for loop range
Use the ARRAY_SIZE macro in the for loops that access queue->fileio.blocks. Macro is already used in a couple of places where this access occurs, but range was hardcoded in these locations. Signed-off-by: Phil Reid <preid@electromag.com.au> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/buffer/industrialio-buffer-dma.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c
index 212cbedc7abb..dd99d273bae9 100644
--- a/drivers/iio/buffer/industrialio-buffer-dma.c
+++ b/drivers/iio/buffer/industrialio-buffer-dma.c
@@ -305,7 +305,7 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer)
queue->fileio.active_block = NULL;
spin_lock_irq(&queue->list_lock);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) {
block = queue->fileio.blocks[i];
/* If we can't re-use it free it */
@@ -323,7 +323,7 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer)
INIT_LIST_HEAD(&queue->incoming);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) {
if (queue->fileio.blocks[i]) {
block = queue->fileio.blocks[i];
if (block->state == IIO_BLOCK_STATE_DEAD) {