USB: musb: do not work if no gadget driver is loaded
authorFelipe Balbi <[email protected]>
Tue, 15 Dec 2009 11:47:30 +0000 (13:47 +0200)
committerGreg Kroah-Hartman <[email protected]>
Wed, 23 Dec 2009 19:34:17 +0000 (11:34 -0800)
On OTG and gadget-only configurations, we need a gadget driver
in order to work properly, so avoid changing operation modes
when there's no gadget driver loaded.

Signed-off-by: Felipe Balbi <[email protected]>
Cc: David Brownell <[email protected]>
Acked-by: Anand Gadiyar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/usb/musb/musb_core.c

index 1041bb734bb49912fa62b6541b386b76b776d247..24ff09754e0ca1fff028e3883333139a8fcea4c5 100644 (file)
@@ -1521,6 +1521,14 @@ irqreturn_t musb_interrupt(struct musb *musb)
                (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral",
                musb->int_usb, musb->int_tx, musb->int_rx);
 
+#ifdef CONFIG_USB_GADGET_MUSB_HDRC
+       if (is_otg_enabled(musb) || is_peripheral_enabled(musb))
+               if (!musb->gadget_driver) {
+                       DBG(5, "No gadget driver loaded\n");
+                       return IRQ_HANDLED;
+               }
+#endif
+
        /* the core can interrupt us for multiple reasons; docs have
         * a generic interrupt flowchart to follow
         */