[PATCH 09/55] staging: comedi: das1800: 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. That
function will handle single and multi samples writes by determining the number
of bytes to add based on the number of samples and the bytes_per_sample().

Also, remove the unnecessary COMEDI_CB_BLOCK event. comedi_buf_write_samples()
will automatically add that event after adding the samples to the async
buffer.

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

diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
index 7b0b65e..246a186 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -488,8 +488,7 @@ static void das1800_handle_fifo_half_full(struct comedi_device *dev,
 		numPoints = devpriv->count;
 	insw(dev->iobase + DAS1800_FIFO, devpriv->ai_buf0, numPoints);
 	munge_data(dev, devpriv->ai_buf0, numPoints);
-	cfc_write_array_to_buffer(s, devpriv->ai_buf0,
-				  numPoints * sizeof(devpriv->ai_buf0[0]));
+	comedi_buf_write_samples(s, devpriv->ai_buf0, numPoints);
 	if (cmd->stop_src == TRIG_COUNT)
 		devpriv->count -= numPoints;
 }
@@ -512,7 +511,7 @@ static void das1800_handle_fifo_not_empty(struct comedi_device *dev,
 		if (!unipolar)
 			;
 		dpnt = munge_bipolar_sample(dev, dpnt);
-		cfc_write_to_buffer(s, dpnt);
+		comedi_buf_write_samples(s, &dpnt, 1);
 		if (cmd->stop_src == TRIG_COUNT)
 			devpriv->count--;
 	}
@@ -543,7 +542,7 @@ static void das1800_flush_dma_channel(struct comedi_device *dev,
 		num_samples = devpriv->count;
 
 	munge_data(dev, buffer, num_samples);
-	cfc_write_array_to_buffer(s, buffer, num_bytes);
+	comedi_buf_write_samples(s, buffer, num_samples);
 	if (cmd->stop_src == TRIG_COUNT)
 		devpriv->count -= num_samples;
 }
@@ -649,7 +648,6 @@ static void das1800_ai_handler(struct comedi_device *dev)
 		das1800_handle_fifo_not_empty(dev, s);
 	}
 
-	async->events |= COMEDI_CB_BLOCK;
 	/* if the card's fifo has overflowed */
 	if (status & OVF) {
 		/*  clear OVF interrupt bit */
-- 
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