]> git.hungrycats.org Git - linux/commitdiff
[PATCH] USB: fix usb hc and shared irq handling
authorStephen Hemminger <shemminger@osdl.org>
Mon, 2 Feb 2004 05:43:56 +0000 (21:43 -0800)
committerStephen Hemminger <shemminger@osdl.org>
Mon, 2 Feb 2004 05:43:56 +0000 (21:43 -0800)
Here is a revised version of the irqreturn_t propagation patch.
The only difference is now ohci-hcd returns IRQ_HANDLED in the remove case.

drivers/usb/core/hcd.c
drivers/usb/core/hcd.h
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/uhci-hcd.c

index 0df71f26cf428d0f9798163b4f9ef7a91765d24a..8ee641df6b9cd530bcd7f86519f034df65d050fb 100644 (file)
@@ -1516,7 +1516,9 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd, struct pt_regs * r)
                return IRQ_NONE;
 
        hcd->saw_irq = 1;
-       hcd->driver->irq (hcd, r);
+       if (hcd->driver->irq (hcd, r) == IRQ_NONE)
+               return IRQ_NONE;
+
        if (hcd->state != start && hcd->state == USB_STATE_HALT)
                usb_hc_died (hcd);
        return IRQ_HANDLED;
index 15cda7f94f24af901a421594c829eef40fe7a367..1d0ea74d014837e6c727f3caf19485bde3b2b21c 100644 (file)
@@ -163,7 +163,7 @@ struct hc_driver {
        const char      *description;   /* "ehci-hcd" etc */
 
        /* irq handler */
-       void    (*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
+       irqreturn_t     (*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
 
        int     flags;
 #define        HCD_MEMORY      0x0001          /* HC regs use memory (else I/O) */
index d15c470784c5b4b1a3691798c97e4d956de16cb4..5c58a16c7693f85dc8d9f575e76839fec9d226cc 100644 (file)
@@ -680,7 +680,7 @@ static void ehci_work (struct ehci_hcd *ehci, struct pt_regs *regs)
 
 /*-------------------------------------------------------------------------*/
 
-static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
+static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
 {
        struct ehci_hcd         *ehci = hcd_to_ehci (hcd);
        u32                     status;
@@ -690,6 +690,12 @@ static void ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs)
 
        status = readl (&ehci->regs->status);
 
+       /* shared irq */
+       if (status == 0) {
+               spin_unlock (&ehci->lock);
+               return IRQ_NONE;
+       }
+
        /* e.g. cardbus physical eject */
        if (status == ~(u32) 0) {
                ehci_dbg (ehci, "device removed\n");
@@ -743,6 +749,7 @@ dead:
                ehci_work (ehci, regs);
 done:
        spin_unlock (&ehci->lock);
+       return IRQ_HANDLED;
 }
 
 /*-------------------------------------------------------------------------*/
index 168c9e9edcc4ae6a3044cea33dcbfc0f10b4ed05..1c3c8e509964e9f879ae9fa0a81d87168ebc9089 100644 (file)
@@ -545,7 +545,7 @@ static int hc_start (struct ohci_hcd *ohci)
 
 /* an interrupt happens */
 
-static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
+static irqreturn_t ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
 {
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
        struct ohci_regs        *regs = ohci->regs;
@@ -560,11 +560,11 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
        } else if ((ints = readl (&regs->intrstatus)) == ~(u32)0) {
                disable (ohci);
                ohci_dbg (ohci, "device removed!\n");
-               return;
+               return IRQ_HANDLED;
 
        /* interrupt for some other device? */
        } else if ((ints &= readl (&regs->intrenable)) == 0) {
-               return;
+               return IRQ_NONE;
        } 
 
        if (ints & OHCI_INTR_UE) {
@@ -604,6 +604,8 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
                // flush those pci writes
                (void) readl (&ohci->regs->control);
        }
+
+       return IRQ_HANDLED;
 }
 
 /*-------------------------------------------------------------------------*/
index c567166757c62b1ca5bbf4b670f07cd9267eb1f9..f166ad77f2ccf0a05aa3ccc89b3e157fa760a02e 100644 (file)
@@ -1909,7 +1909,7 @@ static void uhci_remove_pending_qhs(struct uhci_hcd *uhci)
        spin_unlock_irqrestore(&uhci->urb_remove_list_lock, flags);
 }
 
-static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
+static irqreturn_t uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
 {
        struct uhci_hcd *uhci = hcd_to_uhci(hcd);
        unsigned int io_addr = uhci->io_addr;
@@ -1922,7 +1922,7 @@ static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
         */
        status = inw(io_addr + USBSTS);
        if (!status)    /* shared interrupt, not mine */
-               return;
+               return IRQ_NONE;
        outw(status, io_addr + USBSTS);         /* Clear it */
 
        if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) {
@@ -1963,6 +1963,7 @@ static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
        spin_unlock(&uhci->urb_list_lock);
 
        uhci_finish_completion(hcd, regs);
+       return IRQ_HANDLED;
 }
 
 static void reset_hc(struct uhci_hcd *uhci)