In some cases the irq may not be requested by usb_add_hcd.  E.g. the
interrupt is shared among different parts of the same driver, and by
having only 1 handler which calls the others, helps in making the
driver cleaner.

By exporting usb_hcd_irq, the driver can call the irq handler at the
correct time, without duplicating any code (otherwise, the
functionality of ush_hcd_irq had to be duplicated).

A negative number denotes that the irq should not be requested by
usb_add_hcd.

Signed-off-by: Jan Veldeman <[EMAIL PROTECTED]>

---

 drivers/usb/core/hcd.c |    8 ++++++--
 drivers/usb/core/hcd.h |    2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

2b1d0d7e13b51407e45252bc4c0da99cf36f2947
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fbd938d..5f5ab81 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1673,6 +1673,7 @@ irqreturn_t usb_hcd_irq (int irq, void *
                usb_hc_died (hcd);
        return IRQ_HANDLED;
 }
+EXPORT_SYMBOL_GPL (usb_hcd_irq);
 
 /*-------------------------------------------------------------------------*/
 
@@ -1773,9 +1774,12 @@ EXPORT_SYMBOL (usb_put_hcd);
  * Finish the remaining parts of generic HCD initialization: allocate the
  * buffers of consistent memory, register the bus, request the IRQ line,
  * and call the driver's reset() and start() routines.
+ *
+ * If irqnum is negative, the irq will not be requested. The caller is
+ * responsible to call usb_hcd_irq at the correct time.
  */
 int usb_add_hcd(struct usb_hcd *hcd,
-               unsigned int irqnum, unsigned long irqflags)
+               int irqnum, unsigned long irqflags)
 {
        int retval;
        struct usb_device *rhdev;
@@ -1826,7 +1830,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
                dev_dbg(hcd->self.controller, "supports USB remote wakeup\n");
 
        /* enable irqs just before we start the controller */
-       if (hcd->driver->irq) {
+       if (hcd->driver->irq && (irqnum >= 0)) {
                char    buf[8], *bufp = buf;
 
 #ifdef __sparc__
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 7022aaf..a238559 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -224,7 +224,7 @@ extern struct usb_hcd *usb_create_hcd (c
                struct device *dev, char *bus_name);
 extern void usb_put_hcd (struct usb_hcd *hcd);
 extern int usb_add_hcd(struct usb_hcd *hcd,
-               unsigned int irqnum, unsigned long irqflags);
+               int irqnum, unsigned long irqflags);
 extern void usb_remove_hcd(struct usb_hcd *hcd);
 
 #ifdef CONFIG_PCI
-- 
1.2.4



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to