Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: ath79: simplify MISC IRQ handling

The current code uses multiple if statements for
demultiplexing the different interrupt sources.
Additionally, the MISC interrupt controller has
32 interrupt sources and the current code does not
handles all of them.

Get rid of the if statements and process all interrupt
sources in a loop to fix these issues.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/4874/
Signed-off-by: John Crispin <blogic@openwrt.org>

authored by

Gabor Juhos and committed by
John Crispin
9c099c4e f160a289

+11 -37
+10 -37
arch/mips/ath79/irq.c
··· 35 35 pending = __raw_readl(base + AR71XX_RESET_REG_MISC_INT_STATUS) & 36 36 __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 37 37 38 - if (pending & MISC_INT_UART) 39 - generic_handle_irq(ATH79_MISC_IRQ_UART); 40 - 41 - else if (pending & MISC_INT_DMA) 42 - generic_handle_irq(ATH79_MISC_IRQ_DMA); 43 - 44 - else if (pending & MISC_INT_PERFC) 45 - generic_handle_irq(ATH79_MISC_IRQ_PERFC); 46 - 47 - else if (pending & MISC_INT_TIMER) 48 - generic_handle_irq(ATH79_MISC_IRQ_TIMER); 49 - 50 - else if (pending & MISC_INT_TIMER2) 51 - generic_handle_irq(ATH79_MISC_IRQ_TIMER2); 52 - 53 - else if (pending & MISC_INT_TIMER3) 54 - generic_handle_irq(ATH79_MISC_IRQ_TIMER3); 55 - 56 - else if (pending & MISC_INT_TIMER4) 57 - generic_handle_irq(ATH79_MISC_IRQ_TIMER4); 58 - 59 - else if (pending & MISC_INT_OHCI) 60 - generic_handle_irq(ATH79_MISC_IRQ_OHCI); 61 - 62 - else if (pending & MISC_INT_ERROR) 63 - generic_handle_irq(ATH79_MISC_IRQ_ERROR); 64 - 65 - else if (pending & MISC_INT_GPIO) 66 - generic_handle_irq(ATH79_MISC_IRQ_GPIO); 67 - 68 - else if (pending & MISC_INT_WDOG) 69 - generic_handle_irq(ATH79_MISC_IRQ_WDOG); 70 - 71 - else if (pending & MISC_INT_ETHSW) 72 - generic_handle_irq(ATH79_MISC_IRQ_ETHSW); 73 - 74 - else 38 + if (!pending) { 75 39 spurious_interrupt(); 40 + return; 41 + } 42 + 43 + while (pending) { 44 + int bit = __ffs(pending); 45 + 46 + generic_handle_irq(ATH79_MISC_IRQ(bit)); 47 + pending &= ~BIT(bit); 48 + } 76 49 } 77 50 78 51 static void ar71xx_misc_irq_unmask(struct irq_data *d)
+1
arch/mips/include/asm/mach-ath79/irq.h
··· 14 14 15 15 #define ATH79_MISC_IRQ_BASE 8 16 16 #define ATH79_MISC_IRQ_COUNT 32 17 + #define ATH79_MISC_IRQ(_x) (ATH79_MISC_IRQ_BASE + (_x)) 17 18 18 19 #define ATH79_PCI_IRQ_BASE (ATH79_MISC_IRQ_BASE + ATH79_MISC_IRQ_COUNT) 19 20 #define ATH79_PCI_IRQ_COUNT 6