[kernel] refresh 2.6.35 patches
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-2.6.35 / 208-mips_oprofile_fix.patch
1 --- a/arch/mips/Makefile
2 +++ b/arch/mips/Makefile
3 @@ -49,7 +49,9 @@ ifneq ($(SUBARCH),$(ARCH))
4 endif
5
6 ifndef CONFIG_FUNCTION_TRACER
7 -cflags-y := -ffunction-sections
8 + ifndef CONFIG_PROFILING
9 + cflags-y := -ffunction-sections
10 + endif
11 endif
12 ifdef CONFIG_FUNCTION_GRAPH_TRACER
13 ifndef KBUILD_MCOUNT_RA_ADDRESS
14 --- a/arch/mips/oprofile/op_model_mipsxx.c
15 +++ b/arch/mips/oprofile/op_model_mipsxx.c
16 @@ -298,6 +298,11 @@ static void reset_counters(void *arg)
17 }
18 }
19
20 +static irqreturn_t mipsxx_perfcount_int(int irq, void *dev_id)
21 +{
22 + return mipsxx_perfcount_handler();
23 +}
24 +
25 static int __init mipsxx_init(void)
26 {
27 int counters;
28 @@ -374,6 +379,10 @@ static int __init mipsxx_init(void)
29 save_perf_irq = perf_irq;
30 perf_irq = mipsxx_perfcount_handler;
31
32 + if (cp0_perfcount_irq >= 0)
33 + return request_irq(cp0_perfcount_irq, mipsxx_perfcount_int,
34 + IRQF_SHARED, "Perfcounter", save_perf_irq);
35 +
36 return 0;
37 }
38
39 @@ -381,6 +390,9 @@ static void mipsxx_exit(void)
40 {
41 int counters = op_model_mipsxx_ops.num_counters;
42
43 + if (cp0_perfcount_irq >= 0)
44 + free_irq(cp0_perfcount_irq, save_perf_irq);
45 +
46 counters = counters_per_cpu_to_total(counters);
47 on_each_cpu(reset_counters, (void *)(long)counters, 1);
48