Staging: vme: Correct tsi-148 VME interrupt free routine
authorMartyn Welch <martyn.welch@gefanuc.com>
Wed, 5 Aug 2009 16:38:31 +0000 (17:38 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:02:10 +0000 (12:02 -0700)
As identified by Jiri, the VME interrupt free routine removes the service
routine before disabling the interrupt. Re-order operations to be performed in
the reverse of the request routine.

Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/vme/bridges/vme_tsi148.c

index ad6fc2db437968046c8c0056acbb7b36a7954c14..cdc2919893919e72777ba63571deea1bf736b40c 100644 (file)
@@ -484,21 +484,22 @@ void tsi148_free_irq(int level, int statid)
        /* Get semaphore */
        down(&(vme_irq));
 
-       tsi148_bridge->irq[level - 1].callback[statid].func = NULL;
-       tsi148_bridge->irq[level - 1].callback[statid].priv_data = NULL;
        tsi148_bridge->irq[level - 1].count--;
 
-       /* Disable IRQ level */
+       /* Disable IRQ level if no more interrupts attached at this level*/
        if (tsi148_bridge->irq[level - 1].count == 0) {
-               tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_INTEO);
-               tmp &= ~TSI148_LCSR_INTEO_IRQEO[level - 1];
-               iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEO);
-
                tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_INTEN);
                tmp &= ~TSI148_LCSR_INTEN_IRQEN[level - 1];
                iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEN);
+
+               tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_INTEO);
+               tmp &= ~TSI148_LCSR_INTEO_IRQEO[level - 1];
+               iowrite32be(tmp, tsi148_bridge->base + TSI148_LCSR_INTEO);
        }
 
+       tsi148_bridge->irq[level - 1].callback[statid].func = NULL;
+       tsi148_bridge->irq[level - 1].callback[statid].priv_data = NULL;
+
        /* Release semaphore */
        up(&(vme_irq));
 }