Commit 967e7e5a authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eacc792d
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment