]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix for 16-bit PCMCIA interrupt selection
authorAndrew Morton <akpm@osdl.org>
Tue, 30 Dec 2003 09:00:07 +0000 (01:00 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 30 Dec 2003 09:00:07 +0000 (01:00 -0800)
From: David Hinds <dhinds@sonic.net>

This fixes interrupt allocation for 16-bit PCMCIA cards, so that on systems
supporting ISA bus interrupts, if all ISA interrupts are unavailable, we'll
fall back on sharing the bridge PCI interrupt.

drivers/pcmcia/cs.c

index 3ae9a57a9993544b8ff5864aa4c3f7db996cbfd9..d30ffa72e6a148807fdb4ef7d4290dcf85b89f0c 100644 (file)
@@ -1916,7 +1916,7 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req)
 {
     struct pcmcia_socket *s;
     config_t *c;
-    int ret = 0, irq = 0;
+    int ret = CS_IN_USE, irq = 0;
     
     if (CHECK_HANDLE(handle))
        return CS_BAD_HANDLE;
@@ -1928,13 +1928,9 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req)
        return CS_CONFIGURATION_LOCKED;
     if (c->state & CONFIG_IRQ_REQ)
        return CS_IN_USE;
-    
-    /* Short cut: if there are no ISA interrupts, then it is PCI */
-    if (!s->irq_mask) {
-       irq = s->pci_irq;
-       ret = (irq) ? 0 : CS_IN_USE;
+
 #ifdef CONFIG_PCMCIA_PROBE
-    } else if (s->irq.AssignedIRQ != 0) {
+    if (s->irq.AssignedIRQ != 0) {
        /* If the interrupt is already assigned, it must match */
        irq = s->irq.AssignedIRQ;
        if (req->IRQInfo1 & IRQ_INFO2_VALID) {
@@ -1943,7 +1939,6 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req)
        } else
            ret = ((req->IRQInfo1&IRQ_MASK) == irq) ? 0 : CS_BAD_ARGS;
     } else {
-       ret = CS_IN_USE;
        if (req->IRQInfo1 & IRQ_INFO2_VALID) {
            u_int try, mask = req->IRQInfo2 & s->irq_mask;
            for (try = 0; try < 2; try++) {
@@ -1958,12 +1953,13 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req)
            irq = req->IRQInfo1 & IRQ_MASK;
            ret = try_irq(req->Attributes, irq, 1);
        }
-#else
-    } else {
-       ret = CS_UNSUPPORTED_MODE;
+    }
 #endif
+    if (ret != 0) {
+       if (!s->pci_irq)
+           return ret;
+       irq = s->pci_irq;
     }
-    if (ret != 0) return ret;
 
     if (req->Attributes & IRQ_HANDLE_PRESENT) {
        if (request_irq(irq, req->Handler,