staging: comedi: pcmmio: factor the trigger handling out of interrupt_pcmmio()
Factor the code that actually handles the digital input triggers out of the interrupt handler. 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>
This commit is contained in:
parent
eacc792d2c
commit
967e7e5a99
1 changed files with 56 additions and 52 deletions
|
@ -354,25 +354,11 @@ static void pcmmio_stop_intr(struct comedi_device *dev,
|
|||
pcmmio_dio_write(dev, 0, PCMMIO_PAGE_ENAB, 0);
|
||||
}
|
||||
|
||||
static irqreturn_t interrupt_pcmmio(int irq, void *d)
|
||||
static void pcmmio_handle_dio_intr(struct comedi_device *dev,
|
||||
struct comedi_subdevice *s,
|
||||
unsigned int triggered)
|
||||
{
|
||||
struct comedi_device *dev = d;
|
||||
struct pcmmio_private *devpriv = dev->private;
|
||||
struct comedi_subdevice *s = dev->read_subdev;
|
||||
unsigned int triggered;
|
||||
unsigned char int_pend;
|
||||
|
||||
/* are there any interrupts pending */
|
||||
int_pend = inb(dev->iobase + PCMMIO_INT_PENDING_REG) & 0x07;
|
||||
if (!int_pend)
|
||||
return IRQ_NONE;
|
||||
|
||||
/* get, and clear, the pending interrupts */
|
||||
triggered = pcmmio_dio_read(dev, PCMMIO_PAGE_INT_ID, 0);
|
||||
pcmmio_dio_write(dev, 0, PCMMIO_PAGE_INT_ID, 0);
|
||||
|
||||
if (triggered) {
|
||||
/* TODO here: dispatch io lines to subdevs with commands */
|
||||
unsigned long flags;
|
||||
unsigned oldevents;
|
||||
|
||||
|
@ -421,7 +407,25 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)
|
|||
|
||||
if (oldevents != s->async->events)
|
||||
comedi_event(dev, s);
|
||||
}
|
||||
}
|
||||
|
||||
static irqreturn_t interrupt_pcmmio(int irq, void *d)
|
||||
{
|
||||
struct comedi_device *dev = d;
|
||||
struct comedi_subdevice *s = dev->read_subdev;
|
||||
unsigned int triggered;
|
||||
unsigned char int_pend;
|
||||
|
||||
/* are there any interrupts pending */
|
||||
int_pend = inb(dev->iobase + PCMMIO_INT_PENDING_REG) & 0x07;
|
||||
if (!int_pend)
|
||||
return IRQ_NONE;
|
||||
|
||||
/* get, and clear, the pending interrupts */
|
||||
triggered = pcmmio_dio_read(dev, PCMMIO_PAGE_INT_ID, 0);
|
||||
pcmmio_dio_write(dev, 0, PCMMIO_PAGE_INT_ID, 0);
|
||||
|
||||
pcmmio_handle_dio_intr(dev, s, triggered);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue