This flag in the private data is set when an async command is canceled with the ai (*cancel) operation. Rename the flag to 'ai_cmd_canceled' to clarify its use. Move the check for the flag in the interrupt handler. If the async command was canceled there is no reason to handle the interrupt. Just clear interrupt and return. Also, make sure to clear the interrupt when the device is not attached. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/pcl816.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index e8e800e..ebcaff8 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -122,7 +122,7 @@ struct pcl816_private { unsigned int divisor1; unsigned int divisor2; unsigned int ai_cmd_running:1; - unsigned int irq_was_now_closed:1; + unsigned int ai_cmd_canceled:1; }; static int check_channel_list(struct comedi_device *dev, @@ -373,6 +373,13 @@ static irqreturn_t interrupt_pcl816(int irq, void *d) if (!dev->attached) { comedi_error(dev, "premature interrupt"); + outb(0, dev->iobase + PCL816_CLRINT); + return IRQ_HANDLED; + } + + if (devpriv->ai_cmd_canceled) { + devpriv->ai_cmd_canceled = 0; + outb(0, dev->iobase + PCL816_CLRINT); return IRQ_HANDLED; } @@ -387,11 +394,6 @@ static irqreturn_t interrupt_pcl816(int irq, void *d) outb(0, dev->iobase + PCL816_CLRINT); /* clear INT request */ if (!devpriv->ai_cmd_running || !devpriv->int816_mode) { - if (devpriv->irq_was_now_closed) { - devpriv->irq_was_now_closed = 0; - /* comedi_error(dev,"last IRQ.."); */ - return IRQ_HANDLED; - } comedi_error(dev, "bad IRQ!"); return IRQ_NONE; } @@ -499,7 +501,7 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) s->async->cur_chan = 0; devpriv->ai_cmd_running = 1; devpriv->ai_poll_ptr = 0; - devpriv->irq_was_now_closed = 0; + devpriv->ai_cmd_canceled = 0; if (devpriv->dma) pcl816_ai_setup_dma(dev, s); @@ -608,7 +610,7 @@ static int pcl816_ai_cancel(struct comedi_device *dev, /* Stop A/D */ outb(0, dev->iobase + PCL816_CONTROL); devpriv->ai_cmd_running = 0; - devpriv->irq_was_now_closed = 1; + devpriv->ai_cmd_canceled = 1; devpriv->int816_mode = 0; break; } -- 1.8.5.2 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel