ab0ffdf6f951305865482fc69a47072c05e265b3
[openwrt/svn-archive/archive.git] / target / linux / atheros / patches-2.6.32 / 001-get_c0_compare_int_fix.patch
1 Fix the usage of get_c0_compare_int: override cp0_compare_irq if the returned
2 value is in the MIPS CPU IRQ range to ensure that c0_compare_int_usable()
3 still works.
4
5 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
6
7 Index: linux-2.6.32.7/arch/mips/kernel/cevt-r4k.c
8 ===================================================================
9 --- linux-2.6.32.7.orig/arch/mips/kernel/cevt-r4k.c 2010-01-29 00:06:20.000000000 +0100
10 +++ linux-2.6.32.7/arch/mips/kernel/cevt-r4k.c 2010-02-03 16:59:28.310430064 +0100
11 @@ -168,20 +168,23 @@
12 struct clock_event_device *cd;
13 unsigned int irq;
14
15 - if (!cpu_has_counter || !mips_hpt_frequency)
16 - return -ENXIO;
17 -
18 - if (!c0_compare_int_usable())
19 - return -ENXIO;
20 -
21 /*
22 * With vectored interrupts things are getting platform specific.
23 * get_c0_compare_int is a hook to allow a platform to return the
24 * interrupt number of it's liking.
25 */
26 irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
27 - if (get_c0_compare_int)
28 + if (get_c0_compare_int) {
29 irq = get_c0_compare_int();
30 + if ((irq >= MIPS_CPU_IRQ_BASE) && (irq < MIPS_CPU_IRQ_BASE + 8))
31 + cp0_compare_irq = irq - MIPS_CPU_IRQ_BASE;
32 + }
33 +
34 + if (!cpu_has_counter || !mips_hpt_frequency)
35 + return -ENXIO;
36 +
37 + if (!c0_compare_int_usable())
38 + return -ENXIO;
39
40 cd = &per_cpu(mips_clockevent_device, cpu);
41