diff options
| author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-01-13 10:16:38 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-17 14:31:31 -0800 |
| commit | afd8f40f6f10bb43c445458a36b873add4dd08f3 (patch) | |
| tree | bf73a4fba248d8dd8bb8a6abd6d7b4760d1d507a | |
| parent | ac525a7f724ef47cae087fc2b09978a5fdda829c (diff) | |
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: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/staging/comedi/drivers/ni_labpc_isadma.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/staging/comedi/drivers/ni_labpc_isadma.c b/drivers/staging/comedi/drivers/ni_labpc_isadma.c index 43e4f99f25df..0ce8aad2f342 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_isadma.c +++ b/drivers/staging/comedi/drivers/ni_labpc_isadma.c @@ -29,7 +29,7 @@ #include "ni_labpc_isadma.h" /* 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 */ 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; /* set a minimum and maximum size allowed */ - if (size > dma_buffer_size) - size = dma_buffer_size - dma_buffer_size % sample_size; + if (size > LABPC_ISADMA_BUFFER_SIZE) + size = LABPC_ISADMA_BUFFER_SIZE; else if (size < sample_size) size = sample_size; @@ -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)) 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); if (!dma->virt_addr) { free_dma(dma_chan); @@ -200,7 +200,7 @@ void labpc_free_dma_chan(struct comedi_device *dev) struct labpc_dma_desc *dma = &devpriv->dma_desc; 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); if (dma->chan) free_dma(dma->chan); |
