From 6c4a85123fcea0cc0ddb28b95a1fed84faf58031 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Wed, 6 Sep 2006 16:23:24 +0300 Subject: [PATCH] MUSB: Clean up cable status sysfs_notify() events Clean up cable status sysfs_notify() events Signed-off-by: Tony Lindgren --- drivers/usb/musb/musb_gadget.c | 6 ++---- drivers/usb/musb/musbdefs.h | 6 ------ drivers/usb/musb/plat_uds.c | 24 ++++-------------------- drivers/usb/musb/tusb6010.c | 6 +++--- 4 files changed, 9 insertions(+), 33 deletions(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 5dbeb418876..f6297cbc824 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -973,8 +973,7 @@ static int musb_gadget_enable(struct usb_ep *ep, pEnd->dma ? "dma, " : "", pEnd->wPacketSize); - pThis->status |= MUSB_VBUS_STATUS_CHG; - schedule_work(&pThis->irq_work); + sysfs_notify(&pThis->controller->kobj, NULL, "cable"); fail: spin_unlock_irqrestore(&pThis->Lock, flags); @@ -1017,8 +1016,7 @@ static int musb_gadget_disable(struct usb_ep *ep) /* abort all pending DMA and requests */ nuke(pEnd, -ESHUTDOWN); - pThis->status |= MUSB_VBUS_STATUS_CHG; /* FIXME not for ep_disable!! */ - schedule_work(&pThis->irq_work); + sysfs_notify(&pThis->controller->kobj, NULL, "cable"); spin_unlock_irqrestore(&(pThis->Lock), flags); diff --git a/drivers/usb/musb/musbdefs.h b/drivers/usb/musb/musbdefs.h index 0d6e0efdfff..032357d9648 100644 --- a/drivers/usb/musb/musbdefs.h +++ b/drivers/usb/musb/musbdefs.h @@ -197,9 +197,6 @@ enum musb_g_ep0_state { MGC_END0_STAGE_ACKWAIT, /* after zlp, before statusin */ } __attribute__ ((packed)); -/* driver and cable VBUS status states for musb_irq_work */ -#define MUSB_VBUS_STATUS_CHG (1 << 0) - /* failure codes */ #define MUSB_ERR_WAITING 1 #define MUSB_ERR_VBUS -1 @@ -395,7 +392,6 @@ 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 @@ -450,8 +446,6 @@ struct musb { u8 board_mode; /* enum musb_mode */ int (*board_set_power)(int state); - u8 status; /* status change flags for musb_irq_work */ - s8 bFailCode; /* one of MUSB_ERR_* failure code */ /* active means connected and not suspended */ diff --git a/drivers/usb/musb/plat_uds.c b/drivers/usb/musb/plat_uds.c index ac8d9625bb1..2fb0d530375 100644 --- a/drivers/usb/musb/plat_uds.c +++ b/drivers/usb/musb/plat_uds.c @@ -529,6 +529,8 @@ static irqreturn_t musb_stage0_irq(struct musb * pThis, u8 bIntrUSB, otg_input_changed(pThis, devctl, TRUE, FALSE, (power & MGC_M_POWER_SUSPENDM) ? TRUE : FALSE); + + sysfs_notify(&pThis->controller->kobj, NULL, "cable"); } handled = IRQ_HANDLED; @@ -612,6 +614,8 @@ 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"); } if (bIntrUSB & MGC_M_INTR_SUSPEND) { @@ -1457,24 +1461,6 @@ static DEVICE_ATTR(cable, S_IRUGO, musb_cable_show, NULL); #endif -static void musb_irq_work(void *data) -{ - struct musb *musb = (struct musb *)data; - unsigned long flags; - u8 event = 0; - spin_lock_irqsave(&musb->Lock, flags); - if (musb->status & MUSB_VBUS_STATUS_CHG) { - musb->status &= ~MUSB_VBUS_STATUS_CHG; - event = 1; - } - spin_unlock_irqrestore(&musb->Lock, flags); - -#ifdef CONFIG_SYSFS - if (event) - sysfs_notify(&musb->controller->kobj, NULL, "cable"); -#endif -} - /* -------------------------------------------------------------------------- * Init support */ @@ -1746,8 +1732,6 @@ 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); diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 7d9e09bbb3c..3a1dad2cdea 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -318,8 +318,8 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *base) } DBG(1, "%s\n", musb->is_active ? "b_peripheral" : "b_idle"); - musb->status |= MUSB_VBUS_STATUS_CHG; - schedule_work(&musb->irq_work); + + sysfs_notify(&musb->controller->kobj, NULL, "cable"); } } @@ -355,8 +355,8 @@ 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) { - schedule_work(&musb->irq_work); musb->is_active = 1; + sysfs_notify(&musb->controller->kobj, NULL, "cable"); } DBG(3, "wake %sactive %02x\n", musb->is_active ? "" : "in", reg); -- 2.41.1