> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Juha Yrjölä
> Sent: Wednesday, January 21, 2009 10:54 PM
> To: [email protected]
> Subject: [PATCH] ARM OMAP: Fix race in OMAP2/3 DMA IRQ handling
> 
> CSR must be cleared before invoking the callback.
> 
> If the callback function starts a new, fast DMA transfer on the same
> channel, the completion status might lost if CSR is cleared after
> the callback invocation.
> 
> Signed-off-by: Juha Yrjola <[email protected]>
> ---
>  arch/arm/plat-omap/dma.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
> index 8e6475d..265351b 100755
> --- a/arch/arm/plat-omap/dma.c
> +++ b/arch/arm/plat-omap/dma.c
> @@ -1898,11 +1898,11 @@ static int omap2_dma_handle_ch(int ch)
>               status = dma_read(CSR(ch));
>       }
>  
> +     dma_write(status, CSR(ch));
This is not necessary. Refers line "dma_write(OMAP2_DMA_CSR_CLEAR_MASK, 
CSR(ch));" just above.

It will any way do the job of clearing. In a way, clear done after the callback 
has no effect since the status reg and global IRQ_enable for the particular 
channel is already disabled before that.
> +
>       if (likely(dma_chan[ch].callback != NULL))
>               dma_chan[ch].callback(ch, status, dma_chan[ch].data);
>  
> -     dma_write(status, CSR(ch));
> -
>       return 0;
>  }
>  
> -- 

So dma library is safe from the problem you have described.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-omap" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Regards,
Santosh
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to