From 8d47c085e855da6ce24fa7d9fe3cbb2868f3d8b2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 22 Oct 2014 15:36:33 -0700 Subject: [PATCH] staging: comedi: cb_pcidas: use comedi_buf_write_samples() 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index a0d462fecf20..53afae093c4c 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -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 */ -- 2.39.5