public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP: MUSB: DMA interrupt locking fix
@ 2007-08-31 23:31 Kevin Hilman
  2007-09-01  2:15 ` David Brownell
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Hilman @ 2007-08-31 23:31 UTC (permalink / raw)
  To: linux-omap-open-source

dma_controller_irq() should take the lock (and disable interrupts) as
the main interrupt handler does since the functions it calls assume
this to be the case.

Signed-off-by: Kevin Hilman <khilman@mvista.com>

Index: dev/drivers/usb/musb/musbhsdma.c
===================================================================
--- dev.orig/drivers/usb/musb/musbhsdma.c
+++ dev/drivers/usb/musb/musbhsdma.c
@@ -296,6 +296,7 @@ static irqreturn_t dma_controller_irq(in
 	struct musb_dma_controller *controller =
 		(struct musb_dma_controller *)private_data;
 	struct musb_dma_channel *pImplChannel;
+	struct musb *musb = controller->pDmaPrivate;
 	u8 *mbase = controller->pCoreBase;
 	struct dma_channel *pChannel;
 	u8 bChannel;
@@ -303,6 +304,9 @@ static irqreturn_t dma_controller_irq(in
 	u32 dwAddress;
 	u8 int_hsdma;
 	irqreturn_t retval = IRQ_NONE;
+	unsigned long flags;
+
+	spin_lock_irqsave(&musb->lock, flags);
 
 	int_hsdma = musb_readb(mbase, MUSB_HSDMA_INTR);
 	if (!int_hsdma)
@@ -358,7 +362,7 @@ static irqreturn_t dma_controller_irq(in
 						MUSB_TXCSR_TXPKTRDY);
 				} else
 					musb_dma_completion(
-						controller->pDmaPrivate,
+						musb,
 						pImplChannel->epnum,
 						pImplChannel->transmit);
 			}
@@ -366,6 +370,7 @@ static irqreturn_t dma_controller_irq(in
 	}
 	retval = IRQ_HANDLED;
 done:
+	spin_unlock_irqrestore(&musb->lock, flags);
 	return retval;
 }
 
--

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: OMAP: MUSB: DMA interrupt locking fix
  2007-08-31 23:31 [PATCH] ARM: OMAP: MUSB: DMA interrupt locking fix Kevin Hilman
@ 2007-09-01  2:15 ` David Brownell
  2007-09-17 18:23   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: David Brownell @ 2007-09-01  2:15 UTC (permalink / raw)
  To: linux-omap-open-source, khilman

> From linux-omap-open-source-bounces@linux.omap.com  Fri Aug 31 16:33:15 2007
> Date: Fri, 31 Aug 2007 16:31:06 -0700
> From: Kevin Hilman <khilman@mvista.com>
> To: linux-omap-open-source@linux.omap.com
> Subject: [PATCH] ARM: OMAP: MUSB: DMA interrupt locking fix
>
> dma_controller_irq() should take the lock (and disable interrupts) as
> the main interrupt handler does since the functions it calls assume
> this to be the case.
>
> Signed-off-by: Kevin Hilman <khilman@mvista.com>

Ack.

> Index: dev/drivers/usb/musb/musbhsdma.c
> ===================================================================
> --- dev.orig/drivers/usb/musb/musbhsdma.c
> +++ dev/drivers/usb/musb/musbhsdma.c
> @@ -296,6 +296,7 @@ static irqreturn_t dma_controller_irq(in
>  	struct musb_dma_controller *controller =
>  		(struct musb_dma_controller *)private_data;
>  	struct musb_dma_channel *pImplChannel;
> +	struct musb *musb = controller->pDmaPrivate;
>  	u8 *mbase = controller->pCoreBase;
>  	struct dma_channel *pChannel;
>  	u8 bChannel;
> @@ -303,6 +304,9 @@ static irqreturn_t dma_controller_irq(in
>  	u32 dwAddress;
>  	u8 int_hsdma;
>  	irqreturn_t retval = IRQ_NONE;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&musb->lock, flags);
>  
>  	int_hsdma = musb_readb(mbase, MUSB_HSDMA_INTR);
>  	if (!int_hsdma)
> @@ -358,7 +362,7 @@ static irqreturn_t dma_controller_irq(in
>  						MUSB_TXCSR_TXPKTRDY);
>  				} else
>  					musb_dma_completion(
> -						controller->pDmaPrivate,
> +						musb,
>  						pImplChannel->epnum,
>  						pImplChannel->transmit);
>  			}
> @@ -366,6 +370,7 @@ static irqreturn_t dma_controller_irq(in
>  	}
>  	retval = IRQ_HANDLED;
>  done:
> +	spin_unlock_irqrestore(&musb->lock, flags);
>  	return retval;
>  }
>  
> --
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: OMAP: MUSB: DMA interrupt locking fix
  2007-09-01  2:15 ` David Brownell
@ 2007-09-17 18:23   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2007-09-17 18:23 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap-open-source

* David Brownell <david-b@pacbell.net> [070831 19:18]:
> > From linux-omap-open-source-bounces@linux.omap.com  Fri Aug 31 16:33:15 2007
> > Date: Fri, 31 Aug 2007 16:31:06 -0700
> > From: Kevin Hilman <khilman@mvista.com>
> > To: linux-omap-open-source@linux.omap.com
> > Subject: [PATCH] ARM: OMAP: MUSB: DMA interrupt locking fix
> >
> > dma_controller_irq() should take the lock (and disable interrupts) as
> > the main interrupt handler does since the functions it calls assume
> > this to be the case.
> >
> > Signed-off-by: Kevin Hilman <khilman@mvista.com>
> 
> Ack.
> 
> > Index: dev/drivers/usb/musb/musbhsdma.c
> > ===================================================================
> > --- dev.orig/drivers/usb/musb/musbhsdma.c
> > +++ dev/drivers/usb/musb/musbhsdma.c
> > @@ -296,6 +296,7 @@ static irqreturn_t dma_controller_irq(in
> >  	struct musb_dma_controller *controller =
> >  		(struct musb_dma_controller *)private_data;
> >  	struct musb_dma_channel *pImplChannel;
> > +	struct musb *musb = controller->pDmaPrivate;
> >  	u8 *mbase = controller->pCoreBase;
> >  	struct dma_channel *pChannel;
> >  	u8 bChannel;
> > @@ -303,6 +304,9 @@ static irqreturn_t dma_controller_irq(in
> >  	u32 dwAddress;
> >  	u8 int_hsdma;
> >  	irqreturn_t retval = IRQ_NONE;
> > +	unsigned long flags;
> > +
> > +	spin_lock_irqsave(&musb->lock, flags);
> >  
> >  	int_hsdma = musb_readb(mbase, MUSB_HSDMA_INTR);
> >  	if (!int_hsdma)
> > @@ -358,7 +362,7 @@ static irqreturn_t dma_controller_irq(in
> >  						MUSB_TXCSR_TXPKTRDY);
> >  				} else
> >  					musb_dma_completion(
> > -						controller->pDmaPrivate,
> > +						musb,
> >  						pImplChannel->epnum,
> >  						pImplChannel->transmit);
> >  			}
> > @@ -366,6 +370,7 @@ static irqreturn_t dma_controller_irq(in
> >  	}
> >  	retval = IRQ_HANDLED;
> >  done:
> > +	spin_unlock_irqrestore(&musb->lock, flags);
> >  	return retval;
> >  }

Pushing this today.

Tony

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-09-17 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-31 23:31 [PATCH] ARM: OMAP: MUSB: DMA interrupt locking fix Kevin Hilman
2007-09-01  2:15 ` David Brownell
2007-09-17 18:23   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox