summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-01-13 10:16:41 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-17 14:31:31 -0800
commitf2c6bbe8e02d589a02282c2a260f912ab4f12376 (patch)
treed5529a02090260db6352a793a25107fc0a1b4986 /drivers/staging/comedi
parent72ba5c1612f5ea7f907290903e8fc24ed94aec13 (diff)
staging: comedi: ni_labpc_isadma: move dma programming out of labpc_drain_dma()
The external caller of labpc_drain_dma() does not enable the DMA transfer. Only the call from handle_isa_dma() results in the programmed DMA operation getting enabled. For aesthetics, move the dma programming to handle_isa_dma(). Make sure the DMA operation would actually do something (dma->size != 0) before programming it to avoid enabling the DMA at the end of a stop_src == TRIG_COUNT command. 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>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc_isadma.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/staging/comedi/drivers/ni_labpc_isadma.c b/drivers/staging/comedi/drivers/ni_labpc_isadma.c
index 2fb7e728049b..af13f4b37daa 100644
--- a/drivers/staging/comedi/drivers/ni_labpc_isadma.c
+++ b/drivers/staging/comedi/drivers/ni_labpc_isadma.c
@@ -109,7 +109,6 @@ void labpc_drain_dma(struct comedi_device *dev)
unsigned int residue;
unsigned int nsamples;
unsigned int leftover;
- unsigned long flags;
/*
* residue is the number of bytes left to be done on the dma
@@ -139,13 +138,6 @@ void labpc_drain_dma(struct comedi_device *dev)
dma->size = comedi_samples_to_bytes(s, leftover);
comedi_buf_write_samples(s, dma->virt_addr, nsamples);
-
- /* set address and count for next transfer */
- flags = claim_dma_lock();
- set_dma_mode(dma->chan, DMA_MODE_READ);
- set_dma_addr(dma->chan, dma->hw_addr);
- set_dma_count(dma->chan, dma->size);
- release_dma_lock(flags);
}
EXPORT_SYMBOL_GPL(labpc_drain_dma);
@@ -153,10 +145,18 @@ static void handle_isa_dma(struct comedi_device *dev)
{
struct labpc_private *devpriv = dev->private;
struct labpc_dma_desc *dma = &devpriv->dma_desc;
+ unsigned long flags;
labpc_drain_dma(dev);
- enable_dma(dma->chan);
+ if (dma->size) {
+ flags = claim_dma_lock();
+ set_dma_mode(dma->chan, DMA_MODE_READ);
+ set_dma_addr(dma->chan, dma->hw_addr);
+ set_dma_count(dma->chan, dma->size);
+ enable_dma(dma->chan);
+ release_dma_lock(flags);
+ }
/* clear dma tc interrupt */
devpriv->write_byte(dev, 0x1, DMATC_CLEAR_REG);