[patch 1/4] Make usb_hcd_irq available for multi-role USB controllers with a shared interrupt line

Peter Korsgaard <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
usb-core-hcd-allow-reg-without-request-irq.patch (text/plain, 2.1 KB)
Some multi-role (host/peripheral) USB controllers use a shared interrupt
line for all parts of the chip. Export usb_hcd_irq so drivers can call it
from their interrupt handler instead of duplicating code.
Drivers pass an irqnum of 0 to usb_add_hcd to signal that the interrupt handler
shouldn't be registerred by the core.

Signed-off-by: Peter Korsgaard <[email protected]>

---
 drivers/usb/core/hcd.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: linux/drivers/usb/core/hcd.c
===================================================================
--- linux.orig/drivers/usb/core/hcd.c
+++ linux/drivers/usb/core/hcd.c
@@ -1434,6 +1434,7 @@
 		usb_hc_died (hcd);
 	return IRQ_HANDLED;
 }
+EXPORT_SYMBOL_GPL (usb_hcd_irq);
 
 /*-------------------------------------------------------------------------*/
 
@@ -1540,6 +1541,9 @@
  * 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 0, the irq will not be requested. The caller is responsible
+ * for calling usb_hcd_irq at the correct time.
  */
 int usb_add_hcd(struct usb_hcd *hcd,
 		unsigned int irqnum, unsigned long irqflags)
@@ -1592,7 +1596,7 @@
 		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) {
 		snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
 				hcd->driver->description, hcd->self.busnum);
 		if ((retval = request_irq(irqnum, &usb_hcd_irq, irqflags,

--
Bye, Peter Korsgaard

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.