aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/oprofile/common.c13
-rw-r--r--arch/ppc/kernel/perfmon.c10
-rw-r--r--include/asm-ppc/perfmon.h4
3 files changed, 7 insertions, 20 deletions
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index 486314a0defd..88b4118fd0c5 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -46,19 +46,12 @@ static void op_handle_interrupt(struct pt_regs *regs)
46 46
47static int op_powerpc_setup(void) 47static int op_powerpc_setup(void)
48{ 48{
49#ifdef __powerpc64__
50 int err; 49 int err;
51 50
52 /* Grab the hardware */ 51 /* Grab the hardware */
53 err = reserve_pmc_hardware(op_handle_interrupt); 52 err = reserve_pmc_hardware(op_handle_interrupt);
54 if (err) 53 if (err)
55 return err; 54 return err;
56#else /* __powerpc64__ */
57 /* Install our interrupt handler into the existing hook. */
58 if (request_perfmon_irq(&op_handle_interrupt))
59 return -EBUSY;
60 mb();
61#endif /* __powerpc64__ */
62 55
63 /* Pre-compute the values to stuff in the hardware registers. */ 56 /* Pre-compute the values to stuff in the hardware registers. */
64 model->reg_setup(ctr, &sys, model->num_counters); 57 model->reg_setup(ctr, &sys, model->num_counters);
@@ -78,13 +71,7 @@ static int op_powerpc_setup(void)
78 71
79static void op_powerpc_shutdown(void) 72static void op_powerpc_shutdown(void)
80{ 73{
81#ifdef __powerpc64__
82 release_pmc_hardware(); 74 release_pmc_hardware();
83#else /* __powerpc64__ */
84 mb();
85 /* Remove our interrupt handler. We may be removing this module. */
86 free_perfmon_irq();
87#endif /* __powerpc64__ */
88} 75}
89 76
90static void op_powerpc_cpu_start(void *dummy) 77static void op_powerpc_cpu_start(void *dummy)
diff --git a/arch/ppc/kernel/perfmon.c b/arch/ppc/kernel/perfmon.c
index fa1dad96b830..91e2786ea097 100644
--- a/arch/ppc/kernel/perfmon.c
+++ b/arch/ppc/kernel/perfmon.c
@@ -61,7 +61,7 @@ void (*perf_irq)(struct pt_regs *) = dummy_perf;
61 61
62/* Grab the interrupt, if it's free. 62/* Grab the interrupt, if it's free.
63 * Returns 0 on success, -1 if the interrupt is taken already */ 63 * Returns 0 on success, -1 if the interrupt is taken already */
64int request_perfmon_irq(void (*handler)(struct pt_regs *)) 64int reserve_pmc_hardware(void (*handler)(struct pt_regs *))
65{ 65{
66 int err = 0; 66 int err = 0;
67 67
@@ -71,7 +71,7 @@ int request_perfmon_irq(void (*handler)(struct pt_regs *))
71 perf_irq = handler; 71 perf_irq = handler;
72 else { 72 else {
73 pr_info("perfmon irq already handled by %p\n", perf_irq); 73 pr_info("perfmon irq already handled by %p\n", perf_irq);
74 err = -1; 74 err = -EBUSY;
75 } 75 }
76 76
77 spin_unlock(&perfmon_lock); 77 spin_unlock(&perfmon_lock);
@@ -79,7 +79,7 @@ int request_perfmon_irq(void (*handler)(struct pt_regs *))
79 return err; 79 return err;
80} 80}
81 81
82void free_perfmon_irq(void) 82void release_pmc_hardware(void)
83{ 83{
84 spin_lock(&perfmon_lock); 84 spin_lock(&perfmon_lock);
85 85
@@ -89,5 +89,5 @@ void free_perfmon_irq(void)
89} 89}
90 90
91EXPORT_SYMBOL(perf_irq); 91EXPORT_SYMBOL(perf_irq);
92EXPORT_SYMBOL(request_perfmon_irq); 92EXPORT_SYMBOL(reserve_pmc_hardware);
93EXPORT_SYMBOL(free_perfmon_irq); 93EXPORT_SYMBOL(release_pmc_hardware);
diff --git a/include/asm-ppc/perfmon.h b/include/asm-ppc/perfmon.h
index e9692a603cff..2ae031594a4e 100644
--- a/include/asm-ppc/perfmon.h
+++ b/include/asm-ppc/perfmon.h
@@ -3,8 +3,8 @@
3 3
4extern void (*perf_irq)(struct pt_regs *); 4extern void (*perf_irq)(struct pt_regs *);
5 5
6int request_perfmon_irq(void (*handler)(struct pt_regs *)); 6int reserve_pmc_hardware(void (*handler)(struct pt_regs *));
7void free_perfmon_irq(void); 7void release_pmc_hardware(void);
8 8
9#ifdef CONFIG_FSL_BOOKE 9#ifdef CONFIG_FSL_BOOKE
10void init_pmc_stop(int ctr); 10void init_pmc_stop(int ctr);