[PATCH 10/18] staging: comedi: ni_mio_common: use comedi_buf_read_samples()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use comedi_buf_read_samples() to get the single samples from the async
buffer. The number of samples in the buffer was validated by the callers
so the error checking can be removed. In addition, the core will set the
COMEDI_CB_BLOCK event so it can also be removed.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index c855787..815623c 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -1134,13 +1134,10 @@ static void ni_ao_fifo_load(struct comedi_device *dev,
 	unsigned short d;
 	u32 packed_data;
 	int range;
-	int err = 1;
 
 	chan = async->cur_chan;
 	for (i = 0; i < n; i++) {
-		err &= comedi_buf_get(s, &d);
-		if (err == 0)
-			break;
+		comedi_buf_read_samples(s, &d, 1);
 
 		range = CR_RANGE(cmd->chanlist[chan]);
 
@@ -1148,9 +1145,7 @@ static void ni_ao_fifo_load(struct comedi_device *dev,
 			packed_data = d & 0xffff;
 			/* 6711 only has 16 bit wide ao fifo */
 			if (!devpriv->is_6711) {
-				err &= comedi_buf_get(s, &d);
-				if (err == 0)
-					break;
+				comedi_buf_read_samples(s, &d, 1);
 				chan++;
 				i++;
 				packed_data |= (d << 16) & 0xffff0000;
@@ -1163,8 +1158,6 @@ static void ni_ao_fifo_load(struct comedi_device *dev,
 		chan %= cmd->chanlist_len;
 	}
 	async->cur_chan = chan;
-	if (err == 0)
-		async->events |= COMEDI_CB_OVERFLOW;
 }
 
 /*
@@ -1201,8 +1194,6 @@ static int ni_ao_fifo_half_empty(struct comedi_device *dev,
 
 	ni_ao_fifo_load(dev, s, n);
 
-	s->async->events |= COMEDI_CB_BLOCK;
-
 	return 1;
 }
 
-- 
2.0.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux