Migrate the code for checking and handling the interrupt status handling for ISA DMA transfers into new a new function `labpc_handle_dma_status()` in the "ni_labpc_isadma" module. Provide a dummy inline function in "ni_labpc_isadma.h" if the "ni_labpc_isadma" module is not being built. The static function `handle_isa_dma()` also needs to move across to the new module. Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx> --- drivers/staging/comedi/drivers/ni_labpc.c | 29 +++--------------------- drivers/staging/comedi/drivers/ni_labpc_isadma.c | 27 ++++++++++++++++++++++ drivers/staging/comedi/drivers/ni_labpc_isadma.h | 5 ++++ 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index fc2dfea..2f6c430e 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -904,20 +904,6 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -#ifdef CONFIG_ISA_DMA_API -static void handle_isa_dma(struct comedi_device *dev) -{ - struct labpc_private *devpriv = dev->private; - - labpc_drain_dma(dev); - - enable_dma(devpriv->dma_chan); - - /* clear dma tc interrupt */ - devpriv->write_byte(0x1, dev->iobase + DMATC_CLEAR_REG); -} -#endif - /* read all available samples from ai fifo */ static int labpc_drain_fifo(struct comedi_device *dev) { @@ -1002,18 +988,9 @@ static irqreturn_t labpc_interrupt(int irq, void *d) return IRQ_HANDLED; } -#ifdef CONFIG_ISA_DMA_API - if (devpriv->current_transfer == isa_dma_transfer) { - /* - * if a dma terminal count of external stop trigger - * has occurred - */ - if (devpriv->stat1 & STAT1_GATA0 || - (board->is_labpc1200 && devpriv->stat2 & STAT2_OUTA1)) { - handle_isa_dma(dev); - } - } else -#endif + if (devpriv->current_transfer == isa_dma_transfer) + labpc_handle_dma_status(dev); + else labpc_drain_fifo(dev); if (devpriv->stat1 & STAT1_CNTINT) { diff --git a/drivers/staging/comedi/drivers/ni_labpc_isadma.c b/drivers/staging/comedi/drivers/ni_labpc_isadma.c index c4bfecc..2149596 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_isadma.c +++ b/drivers/staging/comedi/drivers/ni_labpc_isadma.c @@ -137,6 +137,33 @@ void labpc_drain_dma(struct comedi_device *dev) } EXPORT_SYMBOL_GPL(labpc_drain_dma); +static void handle_isa_dma(struct comedi_device *dev) +{ + struct labpc_private *devpriv = dev->private; + + labpc_drain_dma(dev); + + enable_dma(devpriv->dma_chan); + + /* clear dma tc interrupt */ + devpriv->write_byte(0x1, dev->iobase + DMATC_CLEAR_REG); +} + +void labpc_handle_dma_status(struct comedi_device *dev) +{ + const struct labpc_boardinfo *board = comedi_board(dev); + struct labpc_private *devpriv = dev->private; + + /* + * if a dma terminal count of external stop trigger + * has occurred + */ + if (devpriv->stat1 & STAT1_GATA0 || + (board->is_labpc1200 && devpriv->stat2 & STAT2_OUTA1)) + handle_isa_dma(dev); +} +EXPORT_SYMBOL_GPL(labpc_handle_dma_status); + int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan) { struct labpc_private *devpriv = dev->private; diff --git a/drivers/staging/comedi/drivers/ni_labpc_isadma.h b/drivers/staging/comedi/drivers/ni_labpc_isadma.h index 1f322f2..771af4b 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_isadma.h +++ b/drivers/staging/comedi/drivers/ni_labpc_isadma.h @@ -20,6 +20,7 @@ int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan); void labpc_free_dma_chan(struct comedi_device *dev); void labpc_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s); void labpc_drain_dma(struct comedi_device *dev); +void labpc_handle_dma_status(struct comedi_device *dev); #else @@ -47,6 +48,10 @@ static inline void labpc_drain_dma(struct comedi_device *dev) { } +static inline void labpc_handle_dma_status(struct comedi_device *dev) +{ +} + #endif #endif /* _NI_LABPC_ISADMA_H */ -- 1.8.2.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel