From 72639a16704b10cf5fffaa52715929dc8f081528 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 21 Apr 2016 12:04:38 -0700 Subject: [PATCH] staging: comedi: ni_mio_common: absorb mite_handle_b_linkc() Simplfy the LINKC handing by removing the helper function and moving the mite_sync_dma() into the main interrupt handler. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/ni_mio_common.c | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 2e27815bd632..b2657de7cca1 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -927,19 +927,6 @@ static int ni_ai_drain_dma(struct comedi_device *dev) return retval; } -static void mite_handle_b_linkc(struct mite_struct *mite, - struct comedi_device *dev) -{ - struct ni_private *devpriv = dev->private; - struct comedi_subdevice *s = dev->write_subdev; - unsigned long flags; - - spin_lock_irqsave(&devpriv->mite_channel_lock, flags); - if (devpriv->ao_mite_chan) - mite_sync_dma(devpriv->ao_mite_chan, s); - spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); -} - static int ni_ao_wait_for_dma_load(struct comedi_device *dev) { static const int timeout = 10000; @@ -1403,16 +1390,6 @@ static void handle_b_interrupt(struct comedi_device *dev, unsigned int ao_mite_status) { struct comedi_subdevice *s = dev->write_subdev; - /* unsigned short ack=0; */ - -#ifdef PCIDMA - /* Currently, mite.c requires us to handle LINKC */ - if (ao_mite_status & CHSR_LINKC) { - struct ni_private *devpriv = dev->private; - - mite_handle_b_linkc(devpriv->mite, dev); - } -#endif if (b_status == 0xffff) return; @@ -5200,9 +5177,15 @@ static irqreturn_t ni_E_interrupt(int irq, void *d) if (devpriv->ai_mite_chan) ai_mite_status = mite_ack_linkc(devpriv->ai_mite_chan, dev->read_subdev); - if (devpriv->ao_mite_chan) + + if (devpriv->ao_mite_chan) { ao_mite_status = mite_ack_linkc(devpriv->ao_mite_chan, dev->write_subdev); + if (ao_mite_status & CHSR_LINKC) + mite_sync_dma(devpriv->ao_mite_chan, + dev->write_subdev); + } + spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too); } #endif -- 2.20.1