From f81ac41b89798a53f03e2204153598b229958660 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 22 Oct 2014 15:36:45 -0700 Subject: [PATCH] staging: comedi: usbduxfast: use comedi_buf_write_samples() Use comedi_buf_write_samples() to add the samples to the async buffer. That function will determining the number of bytes to add based on the bytes_per_sample(). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxfast.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 95c2ec7ed22a..70ec2f552dfc 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -249,19 +249,17 @@ static void usbduxfast_ai_handle_urb(struct comedi_device *dev, devpriv->ignore--; } else { unsigned int nbytes = urb->actual_length; + unsigned int nsamples = nbytes / bytes_per_sample(s); if (cmd->stop_src == TRIG_COUNT) { - unsigned int nsamples = nbytes / bytes_per_sample(s); - if (devpriv->ai_sample_count < nsamples) { nsamples = devpriv->ai_sample_count; async->events |= COMEDI_CB_EOA; } devpriv->ai_sample_count -= nsamples; - nbytes = nsamples * bytes_per_sample(s); } - cfc_write_array_to_buffer(s, urb->transfer_buffer, nbytes); + comedi_buf_write_samples(s, urb->transfer_buffer, nsamples); } /* if command is still running, resubmit urb for BULK transfer */ -- 2.30.2