Commit b9357cba authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_labpc_isadma: use comedi_buf_write_samples()

Use comedi_buf_write_samples() instead of cfc_write_to_buffer() to add all
the samples to the async buffer in one operation.

The core will add the COMEDI_CB_BLOCK event when data is written to the
async buffer. Remove the unnecessary event in the driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8d185f52
...@@ -91,7 +91,6 @@ void labpc_drain_dma(struct comedi_device *dev) ...@@ -91,7 +91,6 @@ void labpc_drain_dma(struct comedi_device *dev)
int status; int status;
unsigned long flags; unsigned long flags;
unsigned int max_points, num_points, residue, leftover; unsigned int max_points, num_points, residue, leftover;
int i;
status = devpriv->stat1; status = devpriv->stat1;
...@@ -122,9 +121,7 @@ void labpc_drain_dma(struct comedi_device *dev) ...@@ -122,9 +121,7 @@ void labpc_drain_dma(struct comedi_device *dev)
leftover = max_points; leftover = max_points;
} }
/* write data to comedi buffer */ comedi_buf_write_samples(s, devpriv->dma_buffer, num_points);
for (i = 0; i < num_points; i++)
cfc_write_to_buffer(s, devpriv->dma_buffer[i]);
if (cmd->stop_src == TRIG_COUNT) if (cmd->stop_src == TRIG_COUNT)
devpriv->count -= num_points; devpriv->count -= num_points;
...@@ -133,8 +130,6 @@ void labpc_drain_dma(struct comedi_device *dev) ...@@ -133,8 +130,6 @@ void labpc_drain_dma(struct comedi_device *dev)
set_dma_addr(devpriv->dma_chan, devpriv->dma_addr); set_dma_addr(devpriv->dma_chan, devpriv->dma_addr);
set_dma_count(devpriv->dma_chan, leftover * sample_size); set_dma_count(devpriv->dma_chan, leftover * sample_size);
release_dma_lock(flags); release_dma_lock(flags);
async->events |= COMEDI_CB_BLOCK;
} }
EXPORT_SYMBOL_GPL(labpc_drain_dma); EXPORT_SYMBOL_GPL(labpc_drain_dma);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment