staging: comedi: ni_at_a2150: use comedi_bytes_per_sample()
authorH Hartley Sweeten <hartleys@visionengravers.com>
Mon, 12 Jan 2015 17:55:47 +0000 (10:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2015 22:25:19 +0000 (14:25 -0800)
For aesthetics, use the helper function to get the byte size of each sample
instead of using sizeof() the first buffer element.

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_at_a2150.c

index 8265322d4d4c273434b8dad34990d72f062cf42a..7380dac9215cd71144012eb023a7f8bf658d87b2 100644 (file)
@@ -551,14 +551,14 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
        /*  set size of transfer to fill in 1/3 second */
 #define ONE_THIRD_SECOND 333333333
        devpriv->dma_transfer_size =
-           sizeof(devpriv->dma_buffer[0]) * cmd->chanlist_len *
+           comedi_bytes_per_sample(s) * cmd->chanlist_len *
            ONE_THIRD_SECOND / cmd->scan_begin_arg;
        if (devpriv->dma_transfer_size > A2150_DMA_BUFFER_SIZE)
                devpriv->dma_transfer_size = A2150_DMA_BUFFER_SIZE;
-       if (devpriv->dma_transfer_size < sizeof(devpriv->dma_buffer[0]))
-               devpriv->dma_transfer_size = sizeof(devpriv->dma_buffer[0]);
+       if (devpriv->dma_transfer_size < comedi_bytes_per_sample(s))
+               devpriv->dma_transfer_size = comedi_bytes_per_sample(s);
        devpriv->dma_transfer_size -=
-           devpriv->dma_transfer_size % sizeof(devpriv->dma_buffer[0]);
+           devpriv->dma_transfer_size % comedi_bytes_per_sample(s);
        set_dma_count(devpriv->dma, devpriv->dma_transfer_size);
        enable_dma(devpriv->dma);
        release_dma_lock(lock_flags);