[PATCH] usb: musb: move to threaded IRQ

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this allows us to stop exporting the musb_interrupt
handler while also following the main idea of having
threaded IRQs: top half should only check if interrupt
comes from this device.

Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---
 drivers/usb/musb/am35x.c     |    2 +-
 drivers/usb/musb/musb_core.c |   14 ++++++++++----
 drivers/usb/musb/musb_core.h |    2 --
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 08f1d0b6..3080400 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -310,7 +310,7 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
 	}
 
 	if (musb->int_tx || musb->int_rx || musb->int_usb)
-		ret |= musb_interrupt(musb);
+		ret = IRQ_WAKE_THREAD;
 
 eoi:
 	/* EOI needs to be written for the IRQ to be re-asserted. */
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 20a2873..5c0a542 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1493,7 +1493,7 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
 	musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
 
 	if (musb->int_usb || musb->int_tx || musb->int_rx)
-		retval = musb_interrupt(musb);
+		retval = IRQ_WAKE_THREAD;
 
 	spin_unlock_irqrestore(&musb->lock, flags);
 
@@ -1511,13 +1511,17 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
  *
  * called in irq context with spinlock held, irqs blocked
  */
-irqreturn_t musb_interrupt(struct musb *musb)
+static irqreturn_t musb_interrupt(int irq, void *_musb)
 {
+	struct musb	*musb = _musb;
 	irqreturn_t	retval = IRQ_NONE;
+	unsigned long	flags;
 	u8		devctl, power;
 	int		ep_num;
 	u32		reg;
 
+	spin_lock_irqsave(&musb->lock, flags);
+
 	devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
 	power = musb_readb(musb->mregs, MUSB_POWER);
 
@@ -1583,9 +1587,10 @@ irqreturn_t musb_interrupt(struct musb *musb)
 		ep_num++;
 	}
 
+	spin_unlock_irqrestore(&musb->lock, flags);
+
 	return retval;
 }
-EXPORT_SYMBOL_GPL(musb_interrupt);
 
 #ifndef CONFIG_MUSB_PIO_ONLY
 static int __initdata use_dma = 1;
@@ -1943,7 +1948,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 	INIT_WORK(&musb->irq_work, musb_irq_work);
 
 	/* attach to the IRQ */
-	if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
+	if (request_threaded_irq(nIrq, musb->isr, musb_interrupt,
+				0, dev_name(dev), musb)) {
 		dev_err(dev, "request_irq %d failed!\n", nIrq);
 		status = -ENODEV;
 		goto fail3;
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 668eeef..897469b 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -536,8 +536,6 @@ extern void musb_read_fifo(struct musb_hw_ep *ep, u16 len, u8 *dst);
 
 extern void musb_load_testpacket(struct musb *);
 
-extern irqreturn_t musb_interrupt(struct musb *);
-
 extern void musb_hnp_stop(struct musb *musb);
 
 static inline void musb_platform_set_vbus(struct musb *musb, int is_on)
-- 
1.7.6.396.ge0613

--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux