summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/dt282x.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-06-20 13:12:48 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-26 20:08:19 -0400
commite6cff3990d53d93f5b1bf59984a4fe7816f02b63 (patch)
tree9b2421f73c4915e387d9a5c5ea1f098d9a91b5cd /drivers/staging/comedi/drivers/dt282x.c
parentecac148c60d341c9e50e2b65744d2ffde5b884cb (diff)
staging: comedi: dt282x: tidy up dt282x_ao_dma_interrupt()
The main interrupt handler already has the comedi_subdevice pointer needed in this function. Pass that subdevice pointer so that it does not need to be fetched as a local variable. Tidy up the function a bit. 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/dt282x.c')
-rw-r--r--drivers/staging/comedi/drivers/dt282x.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c
index 3071f11ba4f9..40c5794ec5c4 100644
--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -461,31 +461,27 @@ static void dt282x_munge(struct comedi_device *dev,
}
}
-static void dt282x_ao_dma_interrupt(struct comedi_device *dev)
+static void dt282x_ao_dma_interrupt(struct comedi_device *dev,
+ struct comedi_subdevice *s)
{
struct dt282x_private *devpriv = dev->private;
- struct comedi_subdevice *s = dev->write_subdev;
- void *ptr;
+ int cur_dma = devpriv->current_dma_index;
+ void *ptr = devpriv->dma[cur_dma].buf;
int size;
- int i;
outw(devpriv->supcsr | DT2821_CLRDMADNE, dev->iobase + DT2821_SUPCSR);
- i = devpriv->current_dma_index;
- ptr = devpriv->dma[i].buf;
+ disable_dma(devpriv->dma[cur_dma].chan);
- disable_dma(devpriv->dma[i].chan);
-
- devpriv->current_dma_index = 1 - i;
+ devpriv->current_dma_index = 1 - cur_dma;
size = cfc_read_array_from_buffer(s, ptr, devpriv->dma_maxsize);
if (size == 0) {
dev_err(dev->class_dev, "AO underrun\n");
s->async->events |= COMEDI_CB_OVERFLOW;
- return;
+ } else {
+ dt282x_prep_ao_dma(dev, cur_dma, size);
}
- dt282x_prep_ao_dma(dev, i, size);
- return;
}
static void dt282x_ai_dma_interrupt(struct comedi_device *dev)
@@ -556,7 +552,7 @@ static irqreturn_t dt282x_interrupt(int irq, void *d)
if (devpriv->dma_dir == DMA_MODE_READ)
dt282x_ai_dma_interrupt(dev);
else
- dt282x_ao_dma_interrupt(dev);
+ dt282x_ao_dma_interrupt(dev, s_ao);
handled = 1;
}
if (adcsr & DT2821_ADERR) {