| 1 | --- a/arch/mips/oprofile/op_model_mipsxx.c |
| 2 | +++ b/arch/mips/oprofile/op_model_mipsxx.c |
| 3 | @@ -298,6 +298,11 @@ static void reset_counters(void *arg) |
| 4 | } |
| 5 | } |
| 6 | |
| 7 | +static irqreturn_t mipsxx_perfcount_int(int irq, void *dev_id) |
| 8 | +{ |
| 9 | + return mipsxx_perfcount_handler(); |
| 10 | +} |
| 11 | + |
| 12 | static int __init mipsxx_init(void) |
| 13 | { |
| 14 | int counters; |
| 15 | @@ -374,6 +379,10 @@ static int __init mipsxx_init(void) |
| 16 | save_perf_irq = perf_irq; |
| 17 | perf_irq = mipsxx_perfcount_handler; |
| 18 | |
| 19 | + if (cp0_perfcount_irq >= 0) |
| 20 | + return request_irq(cp0_perfcount_irq, mipsxx_perfcount_int, |
| 21 | + IRQF_SHARED, "Perfcounter", save_perf_irq); |
| 22 | + |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | @@ -381,6 +390,9 @@ static void mipsxx_exit(void) |
| 27 | { |
| 28 | int counters = op_model_mipsxx_ops.num_counters; |
| 29 | |
| 30 | + if (cp0_perfcount_irq >= 0) |
| 31 | + free_irq(cp0_perfcount_irq, save_perf_irq); |
| 32 | + |
| 33 | counters = counters_per_cpu_to_total(counters); |
| 34 | on_each_cpu(reset_counters, (void *)(long)counters, 1); |
| 35 | |
| 36 | |