Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e563637b authored by Janani Ravichandran's avatar Janani Ravichandran Committed by Greg Kroah-Hartman
Browse files

staging: comedi: Use ARRAY_SIZE for sizes of arrays

Use ARRAY_SIZE to calculate the size of an array to make code concise.
The semantic patch used can be found here:
https://github.com/coccinelle/coccinellery/commit/9cbab452a3a2e18439e8386d6c4a68ee42c3ee2b



Signed-off-by: default avatarJanani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 222c402a
Loading
Loading
Loading
Loading
+0 −0

Empty file added.

+2 −5
Original line number Original line Diff line number Diff line
@@ -1166,8 +1166,7 @@ static void ni_ai_fifo_read(struct comedi_device *dev,
			comedi_buf_write_samples(s, &data, 1);
			comedi_buf_write_samples(s, &data, 1);
		}
		}
	} else {
	} else {
		if (n > sizeof(devpriv->ai_fifo_buffer) /
		if (n > ARRAY_SIZE(devpriv->ai_fifo_buffer)) {
		    sizeof(devpriv->ai_fifo_buffer[0])) {
			dev_err(dev->class_dev,
			dev_err(dev->class_dev,
				"bug! ai_fifo_buffer too small\n");
				"bug! ai_fifo_buffer too small\n");
			async->events |= COMEDI_CB_ERROR;
			async->events |= COMEDI_CB_ERROR;
@@ -1242,9 +1241,7 @@ static void ni_handle_fifo_dregs(struct comedi_device *dev)
			     NISTC_AI_STATUS1_FIFO_E;
			     NISTC_AI_STATUS1_FIFO_E;
		while (fifo_empty == 0) {
		while (fifo_empty == 0) {
			for (i = 0;
			for (i = 0;
			     i <
			     i < ARRAY_SIZE(devpriv->ai_fifo_buffer); i++) {
			     sizeof(devpriv->ai_fifo_buffer) /
			     sizeof(devpriv->ai_fifo_buffer[0]); i++) {
				fifo_empty = ni_stc_readw(dev,
				fifo_empty = ni_stc_readw(dev,
							  NISTC_AI_STATUS1_REG) &
							  NISTC_AI_STATUS1_REG) &
						NISTC_AI_STATUS1_FIFO_E;
						NISTC_AI_STATUS1_FIFO_E;