Commit 29e3e06d authored by Phil Reid's avatar Phil Reid Committed by Jonathan Cameron

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: default avatarPhil Reid <preid@electromag.com.au>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent c48c7b2e
...@@ -305,7 +305,7 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer) ...@@ -305,7 +305,7 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer)
queue->fileio.active_block = NULL; queue->fileio.active_block = NULL;
spin_lock_irq(&queue->list_lock); 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]; block = queue->fileio.blocks[i];
/* If we can't re-use it free it */ /* If we can't re-use it free it */
...@@ -323,7 +323,7 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer) ...@@ -323,7 +323,7 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer)
INIT_LIST_HEAD(&queue->incoming); 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]) { if (queue->fileio.blocks[i]) {
block = queue->fileio.blocks[i]; block = queue->fileio.blocks[i];
if (block->state == IIO_BLOCK_STATE_DEAD) { if (block->state == IIO_BLOCK_STATE_DEAD) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment