]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
MUSB: Add back irq_work for cable events
authorTony Lindgren <tony@atomide.com>
Fri, 8 Sep 2006 07:54:03 +0000 (10:54 +0300)
committerTony Lindgren <tony@atomide.com>
Fri, 8 Sep 2006 07:54:03 +0000 (10:54 +0300)
This is needed to avoid sleeping function called from invalid context.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
drivers/usb/musb/musb_gadget.c
drivers/usb/musb/musbdefs.h
drivers/usb/musb/plat_uds.c
drivers/usb/musb/tusb6010.c

index c1652124ebb5c9e55aeaa6f20185112aebcc227a..df9d2245f1f23ecc0f29a0b94030a57791e77b25 100644 (file)
@@ -973,7 +973,7 @@ static int musb_gadget_enable(struct usb_ep *ep,
                        pEnd->dma ? "dma, " : "",
                        pEnd->wPacketSize);
 
-       sysfs_notify(&pThis->controller->kobj, NULL, "cable");
+       schedule_work(&pThis->irq_work);
 
 fail:
        spin_unlock_irqrestore(&pThis->Lock, flags);
@@ -1016,7 +1016,7 @@ static int musb_gadget_disable(struct usb_ep *ep)
        /* abort all pending DMA and requests */
        nuke(pEnd, -ESHUTDOWN);
 
-       sysfs_notify(&pThis->controller->kobj, NULL, "cable");
+       schedule_work(&pThis->irq_work);
 
        spin_unlock_irqrestore(&(pThis->Lock), flags);
 
index a4512a62c06d5c416501441564d82844e3de0305..6ec73166fadab4b9f587c4cb41785c18e2d12247 100644 (file)
@@ -392,6 +392,7 @@ struct musb {
        spinlock_t              Lock;
        struct clk              *clock;
        irqreturn_t             (*isr)(int, void *, struct pt_regs *);
+       struct work_struct      irq_work;
 
 #ifdef CONFIG_USB_MUSB_HDRC_HCD
 
index 4f859246f9c619b3b371887d7d959f65cc9e6590..2d684c0870c9387380768c4b789117add36c9713 100644 (file)
@@ -530,7 +530,7 @@ static irqreturn_t musb_stage0_irq(struct musb * pThis, u8 bIntrUSB,
                                                (power & MGC_M_POWER_SUSPENDM)
                                                ? TRUE : FALSE);
 
-                       sysfs_notify(&pThis->controller->kobj, NULL, "cable");
+                       schedule_work(&pThis->irq_work);
                }
 
                handled = IRQ_HANDLED;
@@ -615,7 +615,7 @@ static irqreturn_t musb_stage2_irq(struct musb * pThis, u8 bIntrUSB,
                /* REVISIT all OTG state machine transitions */
                otg_input_changed_X(pThis, FALSE, FALSE);
 
-               sysfs_notify(&pThis->controller->kobj, NULL, "cable");
+               schedule_work(&pThis->irq_work);
        }
 
        if (bIntrUSB & MGC_M_INTR_SUSPEND) {
@@ -1461,6 +1461,14 @@ static DEVICE_ATTR(cable, S_IRUGO, musb_cable_show, NULL);
 
 #endif
 
+/* Only used to provide cable state change events */
+static void musb_irq_work(void *data)
+{
+       struct musb *musb = (struct musb *)data;
+
+       sysfs_notify(&musb->controller->kobj, NULL, "cable");
+}
+
 /* --------------------------------------------------------------------------
  * Init support
  */
@@ -1736,6 +1744,8 @@ fail:
                return status;
        }
 
+       INIT_WORK(&pThis->irq_work, musb_irq_work, pThis);
+
 #ifdef CONFIG_SYSFS
        device_create_file(dev, &dev_attr_mode);
        device_create_file(dev, &dev_attr_cable);
index 9f145e5c1650fc050957ace0ccd1da996b55279f..182711e09f58501d5f2811f552f035b13e1d4a1e 100644 (file)
@@ -344,7 +344,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *base)
                        DBG(1, "%s\n", musb->is_active
                                        ? "b_peripheral" : "b_idle");
 
-                       sysfs_notify(&musb->controller->kobj, NULL, "cable");
+                       schedule_work(&musb->irq_work);
                }
        }
 
@@ -398,7 +398,7 @@ static irqreturn_t tusb_interrupt(int irq, void *__hci, struct pt_regs *r)
                musb_writel(base, TUSB_PRCM_WAKEUP_CLEAR, reg);
                if (reg & ~TUSB_PRCM_WNORCS) {
                        musb->is_active = 1;
-                       sysfs_notify(&musb->controller->kobj, NULL, "cable");
+                       schedule_work(&musb->irq_work);
                }
                DBG(3, "wake %sactive %02x\n",
                                musb->is_active ? "" : "in", reg);