staging: comedi: ni_labpc_isadma: use comedi_buf_write_samples()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 22 Oct 2014 22:36:31 +0000 (15:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2014 08:03:11 +0000 (16:03 +0800)
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: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_labpc_isadma.c

index 967202e0635e0984dab1ad6860fc956a57090399..6d386050e59d74ef4cc1d410b4752d5aee95b577 100644 (file)
@@ -91,7 +91,6 @@ void labpc_drain_dma(struct comedi_device *dev)
        int status;
        unsigned long flags;
        unsigned int max_points, num_points, residue, leftover;
-       int i;
 
        status = devpriv->stat1;
 
@@ -122,9 +121,7 @@ void labpc_drain_dma(struct comedi_device *dev)
                        leftover = max_points;
        }
 
-       /* write data to comedi buffer */
-       for (i = 0; i < num_points; i++)
-               cfc_write_to_buffer(s, devpriv->dma_buffer[i]);
+       comedi_buf_write_samples(s, devpriv->dma_buffer, num_points);
 
        if (cmd->stop_src == TRIG_COUNT)
                devpriv->count -= num_points;
@@ -133,8 +130,6 @@ void labpc_drain_dma(struct comedi_device *dev)
        set_dma_addr(devpriv->dma_chan, devpriv->dma_addr);
        set_dma_count(devpriv->dma_chan, leftover * sample_size);
        release_dma_lock(flags);
-
-       async->events |= COMEDI_CB_BLOCK;
 }
 EXPORT_SYMBOL_GPL(labpc_drain_dma);