staging: comedi: cb_pcidas: use comedi_buf_write_samples()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 22 Oct 2014 22:36:33 +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() 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().

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/cb_pcidas.c

index a0d462fecf20583ce951f5ecbb10eb2aef82c0c9..53afae093c4cf2e0438d8353f4a71834668b0c3b 100644 (file)
@@ -1359,8 +1359,7 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
                }
                insw(devpriv->adc_fifo + ADCDATA, devpriv->ai_buffer,
                     num_samples);
-               cfc_write_array_to_buffer(s, devpriv->ai_buffer,
-                                         num_samples * sizeof(short));
+               comedi_buf_write_samples(s, devpriv->ai_buffer, num_samples);
                devpriv->count -= num_samples;
                if (cmd->stop_src == TRIG_COUNT && devpriv->count == 0)
                        async->events |= COMEDI_CB_EOA;
@@ -1372,11 +1371,14 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
                /*  else if fifo not empty */
        } else if (status & (ADNEI | EOBI)) {
                for (i = 0; i < timeout; i++) {
+                       unsigned short val;
+
                        /*  break if fifo is empty */
                        if ((ADNE & inw(devpriv->control_status +
                                        INT_ADCFIFO)) == 0)
                                break;
-                       cfc_write_to_buffer(s, inw(devpriv->adc_fifo));
+                       val = inw(devpriv->adc_fifo);
+                       comedi_buf_write_samples(s, &val, 1);
                        if (cmd->stop_src == TRIG_COUNT &&
                            --devpriv->count == 0) {
                                /* end of acquisition */