All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] iio: buffer-dma: Use ARRAY_SIZE in for loop range
@ 2016-06-27  3:17 Phil Reid
  2016-06-27  7:29 ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Reid @ 2016-06-27  3:17 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, linux-iio; +Cc: Phil Reid

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>
---
 drivers/iio/buffer/industrialio-buffer-dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c
index 212cbed..dd99d27 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) {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] iio: buffer-dma: Use ARRAY_SIZE in for loop range
  2016-06-27  3:17 [PATCH 1/1] iio: buffer-dma: Use ARRAY_SIZE in for loop range Phil Reid
@ 2016-06-27  7:29 ` Lars-Peter Clausen
  2016-06-27 20:07   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2016-06-27  7:29 UTC (permalink / raw)
  To: Phil Reid, jic23, knaack.h, pmeerw, linux-iio

On 06/27/2016 05:17 AM, Phil Reid wrote:
> 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>

Looks good, thanks.

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] iio: buffer-dma: Use ARRAY_SIZE in for loop range
  2016-06-27  7:29 ` Lars-Peter Clausen
@ 2016-06-27 20:07   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2016-06-27 20:07 UTC (permalink / raw)
  To: Lars-Peter Clausen, Phil Reid, knaack.h, pmeerw, linux-iio

On 27/06/16 08:29, Lars-Peter Clausen wrote:
> On 06/27/2016 05:17 AM, Phil Reid wrote:
>> 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>
> 
> Looks good, thanks.
> 
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch of iio.git - initially pushed out as
testing for the autobuilders to play with it.

Thanks,

Jonathan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-27 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27  3:17 [PATCH 1/1] iio: buffer-dma: Use ARRAY_SIZE in for loop range Phil Reid
2016-06-27  7:29 ` Lars-Peter Clausen
2016-06-27 20:07   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.