libata-acpi: improve dock event handling
[sfrench/cifs-2.6.git] / drivers / isdn / act2000 / act2000_isa.c
index bc98d77c5ecdc0f8179bceccfd1f544832008b97..1bd8960ead3398654970dd627f516f3f8a7a1f3c 100644 (file)
@@ -16,8 +16,6 @@
 #include "act2000_isa.h"
 #include "capi.h"
 
-static act2000_card *irq2card_map[16];
-
 /*
  * Reset Controller, then try to read the Card's signature.
  + Return:
@@ -63,16 +61,11 @@ act2000_isa_detect(unsigned short portbase)
 }
 
 static irqreturn_t
-act2000_isa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+act2000_isa_interrupt(int dummy, void *dev_id)
 {
-        act2000_card *card = irq2card_map[irq];
+        act2000_card *card = dev_id;
         u_char istatus;
 
-        if (!card) {
-                printk(KERN_WARNING
-                       "act2000: Spurious interrupt!\n");
-                return IRQ_NONE;
-        }
         istatus = (inb(ISA_PORT_ISR) & 0x07);
         if (istatus & ISA_ISR_OUT) {
                 /* RX fifo has data */
@@ -87,7 +80,7 @@ act2000_isa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                 printk(KERN_WARNING "act2000: errIRQ\n");
         }
        if (istatus)
-               printk(KERN_DEBUG "act2000: ?IRQ %d %02x\n", irq, istatus);
+               printk(KERN_DEBUG "act2000: ?IRQ %d %02x\n", card->irq, istatus);
        return IRQ_HANDLED;
 }
 
@@ -133,23 +126,25 @@ act2000_isa_enable_irq(act2000_card * card)
 
 /*
  * Install interrupt handler, enable irq on card.
- * If irq is -1, choose next free irq, else irq is given explicitely.
+ * If irq is -1, choose next free irq, else irq is given explicitly.
  */
 int
 act2000_isa_config_irq(act2000_card * card, short irq)
 {
+       int old_irq;
+
         if (card->flags & ACT2000_FLAGS_IVALID) {
-                free_irq(card->irq, NULL);
-                irq2card_map[card->irq] = NULL;
+                free_irq(card->irq, card);
         }
         card->flags &= ~ACT2000_FLAGS_IVALID;
         outb(ISA_COR_IRQOFF, ISA_PORT_COR);
         if (!irq)
                 return 0;
 
-       if (!request_irq(irq, &act2000_isa_interrupt, 0, card->regname, NULL)) {
-               card->irq = irq;
-               irq2card_map[card->irq] = card;
+       old_irq = card->irq;
+       card->irq = irq;
+       if (request_irq(irq, &act2000_isa_interrupt, 0, card->regname, card)) {
+               card->irq = old_irq;
                card->flags |= ACT2000_FLAGS_IVALID;
                 printk(KERN_WARNING
                        "act2000: Could not request irq %d\n",irq);
@@ -188,10 +183,9 @@ act2000_isa_release(act2000_card * card)
         unsigned long flags;
 
         spin_lock_irqsave(&card->lock, flags);
-        if (card->flags & ACT2000_FLAGS_IVALID) {
-                free_irq(card->irq, NULL);
-                irq2card_map[card->irq] = NULL;
-        }
+        if (card->flags & ACT2000_FLAGS_IVALID)
+                free_irq(card->irq, card);
+
         card->flags &= ~ACT2000_FLAGS_IVALID;
         if (card->flags & ACT2000_FLAGS_PVALID)
                 release_region(card->port, ISA_REGION);
@@ -418,7 +412,7 @@ act2000_isa_download(act2000_card * card, act2000_ddef __user * cb)
         p = cblock.buffer;
         if (!access_ok(VERIFY_READ, p, length))
                 return -EFAULT;
-        buf = (u_char *) kmalloc(1024, GFP_KERNEL);
+        buf = kmalloc(1024, GFP_KERNEL);
         if (!buf)
                 return -ENOMEM;
         timeout = 0;