diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-09-19 09:28:21 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-09-21 05:21:08 -0400 |
commit | 82cd02c16be99cba6a97d38488aee8807580a202 (patch) | |
tree | 36d1d79b87ed91df0a0a91164a3acd21cab2e971 | |
parent | 86a5cddbd9676b129cfa2ed7a1a11759d3b2b512 (diff) |
[PATCH] powerpc: reduce oprofile/common.c differences
Rename and slightly modify {request,free}_perfmon_irq in the ppc code.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/oprofile/common.c | 13 | ||||
-rw-r--r-- | arch/ppc/kernel/perfmon.c | 10 | ||||
-rw-r--r-- | include/asm-ppc/perfmon.h | 4 |
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 | ||
47 | static int op_powerpc_setup(void) | 47 | static 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 | ||
79 | static void op_powerpc_shutdown(void) | 72 | static 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 | ||
90 | static void op_powerpc_cpu_start(void *dummy) | 77 | static 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 */ |
64 | int request_perfmon_irq(void (*handler)(struct pt_regs *)) | 64 | int 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 | ||
82 | void free_perfmon_irq(void) | 82 | void 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 | ||
91 | EXPORT_SYMBOL(perf_irq); | 91 | EXPORT_SYMBOL(perf_irq); |
92 | EXPORT_SYMBOL(request_perfmon_irq); | 92 | EXPORT_SYMBOL(reserve_pmc_hardware); |
93 | EXPORT_SYMBOL(free_perfmon_irq); | 93 | EXPORT_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 | ||
4 | extern void (*perf_irq)(struct pt_regs *); | 4 | extern void (*perf_irq)(struct pt_regs *); |
5 | 5 | ||
6 | int request_perfmon_irq(void (*handler)(struct pt_regs *)); | 6 | int reserve_pmc_hardware(void (*handler)(struct pt_regs *)); |
7 | void free_perfmon_irq(void); | 7 | void release_pmc_hardware(void); |
8 | 8 | ||
9 | #ifdef CONFIG_FSL_BOOKE | 9 | #ifdef CONFIG_FSL_BOOKE |
10 | void init_pmc_stop(int ctr); | 10 | void init_pmc_stop(int ctr); |