Commit 2447a27c authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_at_a2150: use comedi_bytes_per_sample()

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 45478548
...@@ -551,14 +551,14 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -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 */ /* set size of transfer to fill in 1/3 second */
#define ONE_THIRD_SECOND 333333333 #define ONE_THIRD_SECOND 333333333
devpriv->dma_transfer_size = 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; ONE_THIRD_SECOND / cmd->scan_begin_arg;
if (devpriv->dma_transfer_size > A2150_DMA_BUFFER_SIZE) if (devpriv->dma_transfer_size > A2150_DMA_BUFFER_SIZE)
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])) if (devpriv->dma_transfer_size < comedi_bytes_per_sample(s))
devpriv->dma_transfer_size = sizeof(devpriv->dma_buffer[0]); devpriv->dma_transfer_size = comedi_bytes_per_sample(s);
devpriv->dma_transfer_size -= 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); set_dma_count(devpriv->dma, devpriv->dma_transfer_size);
enable_dma(devpriv->dma); enable_dma(devpriv->dma);
release_dma_lock(lock_flags); release_dma_lock(lock_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment