From: Juha Yrjola Date: Mon, 25 Sep 2006 23:26:42 +0000 (+0300) Subject: ARM: OMAP2: Add DMA IRQ sanity checks X-Git-Tag: v2.6.18-omap1~40^2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=5ea9c88f7925b30f830d5b742bb1aa2d1576ef3d;p=linux-2.6-omap-h63xx.git ARM: OMAP2: Add DMA IRQ sanity checks Signed-off-by: Juha Yrjola --- diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index 1bbb431843c..713401715dc 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c @@ -930,10 +930,17 @@ static int omap2_dma_handle_ch(int ch) u32 status = OMAP_DMA_CSR_REG(ch); u32 val; - if (!status) + if (!status) { + if (printk_ratelimit()) + printk(KERN_WARNING "Spurious DMA IRQ for lch %d\n", ch); return 0; - if (unlikely(dma_chan[ch].dev_id == -1)) + } + if (unlikely(dma_chan[ch].dev_id == -1)) { + if (printk_ratelimit()) + printk(KERN_WARNING "IRQ %04x for non-allocated DMA" + "channel %d\n", status, ch); return 0; + } if (unlikely(status & OMAP_DMA_DROP_IRQ)) printk(KERN_INFO "DMA synchronization event drop occurred with device " @@ -969,11 +976,15 @@ static irqreturn_t omap2_dma_irq_handler(int irq, void *dev_id, int i; val = omap_readl(OMAP_DMA4_IRQSTATUS_L0); - - for (i = 1; i <= OMAP_LOGICAL_DMA_CH_COUNT; i++) { - int active = val & (1 << (i - 1)); - if (active) - omap2_dma_handle_ch(i - 1); + if (val == 0) { + if (printk_ratelimit()) + printk(KERN_WARNING "Spurious DMA IRQ\n"); + return IRQ_HANDLED; + } + for (i = 0; i < OMAP_LOGICAL_DMA_CH_COUNT && val != 0; i++) { + if (val & 1) + omap2_dma_handle_ch(i); + val >>= 1; } return IRQ_HANDLED;