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>
pEnd->dma ? "dma, " : "",
pEnd->wPacketSize);
- sysfs_notify(&pThis->controller->kobj, NULL, "cable");
+ schedule_work(&pThis->irq_work);
fail:
spin_unlock_irqrestore(&pThis->Lock, flags);
/* 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);
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
(power & MGC_M_POWER_SUSPENDM)
? TRUE : FALSE);
- sysfs_notify(&pThis->controller->kobj, NULL, "cable");
+ schedule_work(&pThis->irq_work);
}
handled = IRQ_HANDLED;
/* 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) {
#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
*/
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);
DBG(1, "%s\n", musb->is_active
? "b_peripheral" : "b_idle");
- sysfs_notify(&musb->controller->kobj, NULL, "cable");
+ schedule_work(&musb->irq_work);
}
}
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);