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

staging: comedi: ni_labpc_isadma: convert 'dma_buffer_size' to a define

For aesthetics, convert this statis const global variable to a define.

Cleanup the maximum 'size' calc in labpc_suggest_transfer_size(). The modulo
operation will always result in '0'.
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 ac525a7f
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "ni_labpc_isadma.h" #include "ni_labpc_isadma.h"
/* size in bytes of dma buffer */ /* size in bytes of dma buffer */
static const int dma_buffer_size = 0xff00; #define LABPC_ISADMA_BUFFER_SIZE 0xff00
/* utility function that suggests a dma transfer size in bytes */ /* utility function that suggests a dma transfer size in bytes */
static unsigned int labpc_suggest_transfer_size(struct comedi_device *dev, static unsigned int labpc_suggest_transfer_size(struct comedi_device *dev,
...@@ -50,8 +50,8 @@ static unsigned int labpc_suggest_transfer_size(struct comedi_device *dev, ...@@ -50,8 +50,8 @@ static unsigned int labpc_suggest_transfer_size(struct comedi_device *dev,
size = (freq / 3) * sample_size; size = (freq / 3) * sample_size;
/* set a minimum and maximum size allowed */ /* set a minimum and maximum size allowed */
if (size > dma_buffer_size) if (size > LABPC_ISADMA_BUFFER_SIZE)
size = dma_buffer_size - dma_buffer_size % sample_size; size = LABPC_ISADMA_BUFFER_SIZE;
else if (size < sample_size) else if (size < sample_size)
size = sample_size; size = sample_size;
...@@ -178,7 +178,7 @@ void labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan) ...@@ -178,7 +178,7 @@ void labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan)
if (request_dma(dma_chan, dev->board_name)) if (request_dma(dma_chan, dev->board_name))
return; return;
dma->virt_addr = dma_alloc_coherent(NULL, dma_buffer_size, dma->virt_addr = dma_alloc_coherent(NULL, LABPC_ISADMA_BUFFER_SIZE,
&dma->hw_addr, GFP_KERNEL); &dma->hw_addr, GFP_KERNEL);
if (!dma->virt_addr) { if (!dma->virt_addr) {
free_dma(dma_chan); free_dma(dma_chan);
...@@ -200,7 +200,7 @@ void labpc_free_dma_chan(struct comedi_device *dev) ...@@ -200,7 +200,7 @@ void labpc_free_dma_chan(struct comedi_device *dev)
struct labpc_dma_desc *dma = &devpriv->dma_desc; struct labpc_dma_desc *dma = &devpriv->dma_desc;
if (dma->virt_addr) if (dma->virt_addr)
dma_free_coherent(NULL, dma_buffer_size, dma_free_coherent(NULL, LABPC_ISADMA_BUFFER_SIZE,
dma->virt_addr, dma->hw_addr); dma->virt_addr, dma->hw_addr);
if (dma->chan) if (dma->chan)
free_dma(dma->chan); free_dma(dma->chan);
......
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