staging: comedi: adl_pci9118: use comedi_bytes_to_samples()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 11 Nov 2014 00:57:56 +0000 (17:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Nov 2014 23:31:45 +0000 (15:31 -0800)
Remove the assumption of the sample size by using the comedi_bytes_to_samples()
helper function to convert the number of bytes to the number of samples.

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

index b527748658f0fe8ac8d795d1ea8f639ff98da470..498e0c7775e5cb0a305cae854b1bfb92947f7664 100644 (file)
@@ -607,11 +607,9 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
        struct pci9118_private *devpriv = dev->private;
        struct comedi_cmd *cmd = &s->async->cmd;
        struct pci9118_dmabuf *dmabuf = &devpriv->dmabuf[devpriv->dma_actbuf];
-       unsigned int nsamples;
+       unsigned int nsamples = comedi_bytes_to_samples(s, dmabuf->use_size);
        unsigned int next_dma_buf;
 
-       nsamples = dmabuf->use_size >> 1;       /* number of received samples */
-
        if (devpriv->dma_doublebuf) {   /*
                                         * switch DMA buffers if is used
                                         * double buffering