[PATCH 45/55] staging: comedi: hwdrv_apci3120: use comedi_buf_write_samples()

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

 



Use comedi_buf_write_samples() to add the samples to the async buffer.

The COMEDI_CB_EOS and COMEDI_CB_OVERFLOW events will be automatically
handled by the core. Remove the unecessary handling in the driver.

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

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index 4959fc6..975ee5f 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -1313,18 +1313,13 @@ static int apci3120_interrupt_handle_eos(struct comedi_device *dev)
 {
 	struct apci3120_private *devpriv = dev->private;
 	struct comedi_subdevice *s = dev->read_subdev;
-	int n_chan, i;
-	int err = 1;
-
-	n_chan = devpriv->ui_AiNbrofChannels;
-
-	for (i = 0; i < n_chan; i++)
-		err &= comedi_buf_put(s, inw(dev->iobase + 0));
-
-	s->async->events |= COMEDI_CB_EOS;
+	unsigned short val;
+	int i;
 
-	if (err == 0)
-		s->async->events |= COMEDI_CB_OVERFLOW;
+	for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) {
+		val = inw(dev->iobase + 0);
+		comedi_buf_write_samples(s, &val, 1);
+	}
 
 	return 0;
 }
-- 
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