On 2014-04-24 00:07, H Hartley Sweeten wrote:
The helper functions that handle reading the analog input samples for the interrupt function both call cfc_handle_events() and clear the interrupt request at various times. Move this to the main interrupt handler to make sure the events are posted and the interrupt request is cleared. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/adv_pci1710.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 353b832..56186f0 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -752,19 +752,15 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, if (m & Status_FE) { dev_dbg(dev->class_dev, "A/D FIFO empty (%4x)\n", m); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - cfc_handle_events(dev, s); return; } if (m & Status_FF) { dev_dbg(dev->class_dev, "A/D FIFO Full status (Fatal Error!) (%4x)\n", m); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - cfc_handle_events(dev, s); return; } - outb(0, dev->iobase + PCI171x_CLRINT); /* clear our INT request */ - for (; !(inw(dev->iobase + PCI171x_STATUS) & Status_FE);) { #ifdef PCI171x_PARANOIDCHECK sampl = inw(dev->iobase + PCI171x_AD_DATA); @@ -780,7 +776,6 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, 12); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - cfc_handle_events(dev, s); return; } comedi_buf_put(s->async, sampl & 0x0fff); @@ -793,22 +788,16 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, if (s->async->cur_chan >= cmd->chanlist_len) s->async->cur_chan = 0; - if (s->async->cur_chan == 0) { /* one scan done */ devpriv->ai_act_scan++; if (cmd->stop_src == TRIG_COUNT && devpriv->ai_act_scan >= cmd->stop_arg) { /* all data sampled */ s->async->events |= COMEDI_CB_EOA; - cfc_handle_events(dev, s); return; } } } - - outb(0, dev->iobase + PCI171x_CLRINT); /* clear our INT request */ - - cfc_handle_events(dev, s); } /* @@ -839,7 +828,6 @@ static int move_block_from_fifo(struct comedi_device *dev, sampl); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - cfc_handle_events(dev, s); return 1; } comedi_buf_put(s->async, sampl & 0x0fff); @@ -869,14 +857,12 @@ static void pci1710_handle_fifo(struct comedi_device *dev, if (!(m & Status_FH)) { dev_dbg(dev->class_dev, "A/D FIFO not half full! (%4x)\n", m); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - cfc_handle_events(dev, s); return; } if (m & Status_FF) { dev_dbg(dev->class_dev, "A/D FIFO Full status (Fatal Error!) (%4x)\n", m); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - cfc_handle_events(dev, s); return; } @@ -897,12 +883,8 @@ static void pci1710_handle_fifo(struct comedi_device *dev, devpriv->ai_act_scan >= cmd->stop_arg) { /* all data sampled */ s->async->events |= COMEDI_CB_EOA; - cfc_handle_events(dev, s); return; } - outb(0, dev->iobase + PCI171x_CLRINT); /* clear our INT request */ - - cfc_handle_events(dev, s); } /* @@ -945,6 +927,10 @@ static irqreturn_t interrupt_service_pci1710(int irq, void *d) else pci1710_handle_fifo(dev, s); + cfc_handle_events(dev, s); + + outb(0, dev->iobase + PCI171x_CLRINT); + return IRQ_HANDLED; }
It would be better to clear the interrupt _before_ calling pci1710_handle_every_sample() or pci1710_handle_fifo() in case new data arrives (and reasserts the interrupt) just after you've read the old data.
-- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=- _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel