Commit 82cd02c1 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Paul Mackerras

[PATCH] powerpc: reduce oprofile/common.c differences

Rename and slightly modify {request,free}_perfmon_irq in the ppc code.
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 86a5cddb
...@@ -46,19 +46,12 @@ static void op_handle_interrupt(struct pt_regs *regs) ...@@ -46,19 +46,12 @@ static void op_handle_interrupt(struct pt_regs *regs)
static int op_powerpc_setup(void) static int op_powerpc_setup(void)
{ {
#ifdef __powerpc64__
int err; int err;
/* Grab the hardware */ /* Grab the hardware */
err = reserve_pmc_hardware(op_handle_interrupt); err = reserve_pmc_hardware(op_handle_interrupt);
if (err) if (err)
return err; return err;
#else /* __powerpc64__ */
/* Install our interrupt handler into the existing hook. */
if (request_perfmon_irq(&op_handle_interrupt))
return -EBUSY;
mb();
#endif /* __powerpc64__ */
/* Pre-compute the values to stuff in the hardware registers. */ /* Pre-compute the values to stuff in the hardware registers. */
model->reg_setup(ctr, &sys, model->num_counters); model->reg_setup(ctr, &sys, model->num_counters);
...@@ -78,13 +71,7 @@ static int op_powerpc_setup(void) ...@@ -78,13 +71,7 @@ static int op_powerpc_setup(void)
static void op_powerpc_shutdown(void) static void op_powerpc_shutdown(void)
{ {
#ifdef __powerpc64__
release_pmc_hardware(); release_pmc_hardware();
#else /* __powerpc64__ */
mb();
/* Remove our interrupt handler. We may be removing this module. */
free_perfmon_irq();
#endif /* __powerpc64__ */
} }
static void op_powerpc_cpu_start(void *dummy) static void op_powerpc_cpu_start(void *dummy)
......
...@@ -61,7 +61,7 @@ void (*perf_irq)(struct pt_regs *) = dummy_perf; ...@@ -61,7 +61,7 @@ void (*perf_irq)(struct pt_regs *) = dummy_perf;
/* Grab the interrupt, if it's free. /* Grab the interrupt, if it's free.
* Returns 0 on success, -1 if the interrupt is taken already */ * Returns 0 on success, -1 if the interrupt is taken already */
int request_perfmon_irq(void (*handler)(struct pt_regs *)) int reserve_pmc_hardware(void (*handler)(struct pt_regs *))
{ {
int err = 0; int err = 0;
...@@ -71,7 +71,7 @@ int request_perfmon_irq(void (*handler)(struct pt_regs *)) ...@@ -71,7 +71,7 @@ int request_perfmon_irq(void (*handler)(struct pt_regs *))
perf_irq = handler; perf_irq = handler;
else { else {
pr_info("perfmon irq already handled by %p\n", perf_irq); pr_info("perfmon irq already handled by %p\n", perf_irq);
err = -1; err = -EBUSY;
} }
spin_unlock(&perfmon_lock); spin_unlock(&perfmon_lock);
...@@ -79,7 +79,7 @@ int request_perfmon_irq(void (*handler)(struct pt_regs *)) ...@@ -79,7 +79,7 @@ int request_perfmon_irq(void (*handler)(struct pt_regs *))
return err; return err;
} }
void free_perfmon_irq(void) void release_pmc_hardware(void)
{ {
spin_lock(&perfmon_lock); spin_lock(&perfmon_lock);
...@@ -89,5 +89,5 @@ void free_perfmon_irq(void) ...@@ -89,5 +89,5 @@ void free_perfmon_irq(void)
} }
EXPORT_SYMBOL(perf_irq); EXPORT_SYMBOL(perf_irq);
EXPORT_SYMBOL(request_perfmon_irq); EXPORT_SYMBOL(reserve_pmc_hardware);
EXPORT_SYMBOL(free_perfmon_irq); EXPORT_SYMBOL(release_pmc_hardware);
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
extern void (*perf_irq)(struct pt_regs *); extern void (*perf_irq)(struct pt_regs *);
int request_perfmon_irq(void (*handler)(struct pt_regs *)); int reserve_pmc_hardware(void (*handler)(struct pt_regs *));
void free_perfmon_irq(void); void release_pmc_hardware(void);
#ifdef CONFIG_FSL_BOOKE #ifdef CONFIG_FSL_BOOKE
void init_pmc_stop(int ctr); void init_pmc_stop(int ctr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment