- musb_check_mode() as replacement - Use sysfs_notify_dirent() instead of sysfs_notify() Signed-off-by: Krogerus Heikki (EXT-Teleca/Helsinki) <ext-heikki.krogerus@xxxxxxxxx> --- drivers/usb/musb/musb_core.c | 24 ++++++------------------ drivers/usb/musb/musb_core.h | 15 ++++++++++++++- drivers/usb/musb/musb_gadget.c | 4 ++-- drivers/usb/musb/tusb6010.c | 6 +++--- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index af77e46..f9cbae2 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -691,7 +691,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, handled = IRQ_HANDLED; } - schedule_work(&musb->irq_work); + musb_check_mode(musb); return handled; } @@ -797,7 +797,7 @@ static irqreturn_t musb_stage2_irq(struct musb *musb, u8 int_usb, break; } - schedule_work(&musb->irq_work); + musb_check_mode(musb); } if (int_usb & MUSB_INTR_SUSPEND) { @@ -847,7 +847,7 @@ static irqreturn_t musb_stage2_irq(struct musb *musb, u8 int_usb, musb->is_active = 0; break; } - schedule_work(&musb->irq_work); + musb_check_mode(musb); } @@ -1743,18 +1743,6 @@ static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store); #endif /* sysfs */ -/* Only used to provide driver mode change events */ -static void musb_irq_work(struct work_struct *data) -{ - struct musb *musb = container_of(data, struct musb, irq_work); - static int old_state; - - if (musb->xceiv.state != old_state) { - old_state = musb->xceiv.state; - sysfs_notify(&musb->controller->kobj, NULL, "mode"); - } -} - /* -------------------------------------------------------------------------- * Init support */ @@ -1968,9 +1956,6 @@ bad_config: if (status < 0) goto fail2; - /* Init IRQ workqueue before request_irq */ - INIT_WORK(&musb->irq_work, musb_irq_work); - /* attach to the IRQ */ if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) { dev_err(dev, "request_irq %d failed!\n", nIrq); @@ -2054,6 +2039,9 @@ bad_config: status = device_create_file(dev, &dev_attr_srp); #endif /* CONFIG_USB_GADGET_MUSB_HDRC */ status = 0; + musb->sysfs_mode = sysfs_get_dirent(musb->controller->kobj.sd, "mode"); + if (!musb->sysfs_mode) + goto fail2; #endif if (status) goto fail2; diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 630946a..8923482 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -308,7 +308,6 @@ struct musb { spinlock_t lock; struct clk *clock; irqreturn_t (*isr)(int, void *); - struct work_struct irq_work; /* this hub status bit is reserved by USB 2.0 and not seen by usbcore */ #define MUSB_PORT_STAT_RESUME (1 << 31) @@ -434,6 +433,8 @@ struct musb { #ifdef MUSB_CONFIG_PROC_FS struct proc_dir_entry *proc_entry; #endif + struct sysfs_dirent *sysfs_mode; + struct sysfs_dirent *sysfs_vbus; }; static inline void musb_set_vbus(struct musb *musb, int is_on) @@ -512,6 +513,18 @@ static inline void musb_configure_ep0(struct musb *musb) } #endif /* CONFIG_BLACKFIN */ +/* Only used to provide driver mode change events */ +static inline void musb_check_mode(struct musb *musb) +{ +#ifdef CONFIG_SYSFS + static int old_state; + + if (musb->xceiv.state != old_state) { + old_state = musb->xceiv.state; + sysfs_notify_dirent(musb->sysfs_mode); + } +#endif +} /***************************** Glue it together *****************************/ diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index c7ebd08..af3d6cf 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -982,7 +982,7 @@ static int musb_gadget_enable(struct usb_ep *ep, musb_ep->dma ? "dma, " : "", musb_ep->packet_sz); - schedule_work(&musb->irq_work); + musb_check_mode(musb); fail: spin_unlock_irqrestore(&musb->lock, flags); @@ -1027,7 +1027,7 @@ static int musb_gadget_disable(struct usb_ep *ep) /* abort all pending DMA and requests */ nuke(musb_ep, -ESHUTDOWN); - schedule_work(&musb->irq_work); + musb_check_mode(musb); spin_unlock_irqrestore(&(musb->lock), flags); diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 9e20fd0..e06aee9 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -712,7 +712,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) DBG(2, "vbus change, %s, otg %03x\n", otg_state_string(musb), otg_stat); idle_timeout = jiffies + (1 * HZ); - schedule_work(&musb->irq_work); + musb_check_mode(musb); } else /* A-dev state machine */ { DBG(2, "vbus change, %s, otg %03x\n", @@ -801,7 +801,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) break; } } - schedule_work(&musb->irq_work); + musb_check_mode(musb); return idle_timeout; } @@ -851,7 +851,7 @@ static irqreturn_t tusb_interrupt(int irq, void *__hci) musb_writel(tbase, TUSB_PRCM_WAKEUP_CLEAR, reg); if (reg & ~TUSB_PRCM_WNORCS) { musb->is_active = 1; - schedule_work(&musb->irq_work); + musb_check_mode(musb); } DBG(3, "wake %sactive %02x\n", musb->is_active ? "" : "in", reg); -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html