aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/addi_apci_3120.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-11-04 10:55:30 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-07 09:34:05 -0800
commitf50205f0478c35d9d6f3cc3e315ccdfcdaba17e4 (patch)
tree1aa874c777b9b488176ed0d71b5ecc34fd5431d5 /drivers/staging/comedi/drivers/addi_apci_3120.c
parentstaging: comedi: addi_apci_3120: change params to apci3120_interrupt_dma() (diff)
downloadlinux-dev-f50205f0478c35d9d6f3cc3e315ccdfcdaba17e4.tar.xz
linux-dev-f50205f0478c35d9d6f3cc3e315ccdfcdaba17e4.zip
staging: comedi: addi_apci_3120: switch DMA buffers after writing samples
Currently the DMA buffers are switched before writing the current samples to the async buffer. This works but when the EOA event happens we end up with an outstanding DMA operation in progress that gets terminated by the (*cancel). Avoid the outstanding DMA operation by switching the DMA buffers after writing the samples. The driver will detect the EOA event and not retart the DMA. 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/drivers/addi_apci_3120.c')
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_3120.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c
index ea53694e0d32..ba96fe5910e1 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -456,17 +456,8 @@ static void apci3120_interrupt_dma(struct comedi_device *dev,
async->events |= COMEDI_CB_ERROR;
return;
}
- nsamples = comedi_bytes_to_samples(s, nbytes);
-
- if (devpriv->use_double_buffer) {
- struct apci3120_dmabuf *next_dmabuf;
-
- next_dmabuf = &devpriv->dmabuf[!devpriv->cur_dmabuf];
-
- /* start DMA on next buffer */
- apci3120_init_dma(dev, next_dmabuf);
- }
+ nsamples = comedi_bytes_to_samples(s, nbytes);
if (nsamples) {
comedi_buf_write_samples(s, dmabuf->virt, nsamples);
@@ -479,10 +470,12 @@ static void apci3120_interrupt_dma(struct comedi_device *dev,
return;
if (devpriv->use_double_buffer) {
- /* switch dma buffers for next interrupt */
+ /* switch DMA buffers for next interrupt */
devpriv->cur_dmabuf = !devpriv->cur_dmabuf;
+ dmabuf = &devpriv->dmabuf[devpriv->cur_dmabuf];
+ apci3120_init_dma(dev, dmabuf);
} else {
- /* restart DMA if is not using double buffering */
+ /* restart DMA if not using double buffering */
apci3120_init_dma(dev, dmabuf);
}
}