staging: comedi: pcmuio: tidy up pcmuio_handle_asic_interrupt()
Unfortunatly, since there could be two asics, we can't use dev->read_subdev to get the subdevice. But, the comedi_subdevice associated with the 'asic' can easily be calculated. This allows removing the for () loop that searched for the correct subdevice. Tidy up the function. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
099ec87df0
commit
741ba8cdf0
1 changed files with 14 additions and 28 deletions
|
@ -354,38 +354,24 @@ done:
|
||||||
|
|
||||||
static int pcmuio_handle_asic_interrupt(struct comedi_device *dev, int asic)
|
static int pcmuio_handle_asic_interrupt(struct comedi_device *dev, int asic)
|
||||||
{
|
{
|
||||||
struct pcmuio_subdev_private *subpriv;
|
/* there are could be two asics so we can't use dev->read_subdev */
|
||||||
|
struct comedi_subdevice *s = &dev->subdevices[asic * 2];
|
||||||
unsigned long iobase = dev->iobase + (asic * PCMUIO_ASIC_IOSIZE);
|
unsigned long iobase = dev->iobase + (asic * PCMUIO_ASIC_IOSIZE);
|
||||||
unsigned int triggered = 0;
|
unsigned int val;
|
||||||
int got1 = 0;
|
|
||||||
unsigned char int_pend;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
int_pend = inb(iobase + PCMUIO_INT_PENDING_REG) & 0x07;
|
/* are there any interrupts pending */
|
||||||
if (int_pend) {
|
val = inb(iobase + PCMUIO_INT_PENDING_REG) & 0x07;
|
||||||
triggered = pcmuio_read(dev, asic, PCMUIO_PAGE_INT_ID, 0);
|
if (!val)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* get, and clear, the pending interrupts */
|
||||||
|
val = pcmuio_read(dev, asic, PCMUIO_PAGE_INT_ID, 0);
|
||||||
pcmuio_write(dev, 0, asic, PCMUIO_PAGE_INT_ID, 0);
|
pcmuio_write(dev, 0, asic, PCMUIO_PAGE_INT_ID, 0);
|
||||||
|
|
||||||
++got1;
|
/* handle the pending interrupts */
|
||||||
}
|
pcmuio_handle_intr_subdev(dev, s, val);
|
||||||
|
|
||||||
if (triggered) {
|
return 1;
|
||||||
struct comedi_subdevice *s;
|
|
||||||
/* TODO here: dispatch io lines to subdevs with commands.. */
|
|
||||||
for (i = 0; i < dev->n_subdevices; i++) {
|
|
||||||
s = &dev->subdevices[i];
|
|
||||||
subpriv = s->private;
|
|
||||||
if (subpriv->intr.asic == asic) {
|
|
||||||
/*
|
|
||||||
* This is an interrupt subdev, and it
|
|
||||||
* matches this asic!
|
|
||||||
*/
|
|
||||||
pcmuio_handle_intr_subdev(dev, s,
|
|
||||||
triggered);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return got1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static irqreturn_t pcmuio_interrupt(int irq, void *d)
|
static irqreturn_t pcmuio_interrupt(int irq, void *d)
|
||||||
|
|
Loading…
Add table
Reference in a new issue