Commit 55f05234 authored by Russell King's avatar Russell King Committed by Russell King

[ARM] 3/4 Rename common oprofile code

The common oprofile code assumes the name "PMU" (from Intel's
performance management unit).  This is misleading when we
start adding oprofile support for other machine types which
don't use the same terminology.  Call it op_arm_* instead of
pmu_*.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 7c5b3fc2
......@@ -16,17 +16,17 @@
#include "op_counter.h"
#include "op_arm_model.h"
static struct op_arm_model_spec *pmu_model;
static int pmu_enabled;
static struct semaphore pmu_sem;
static struct op_arm_model_spec *op_arm_model;
static int op_arm_enabled;
static struct semaphore op_arm_sem;
struct op_counter_config counter_config[OP_MAX_COUNTER];
static int pmu_create_files(struct super_block *sb, struct dentry *root)
static int op_arm_create_files(struct super_block *sb, struct dentry *root)
{
unsigned int i;
for (i = 0; i < pmu_model->num_counters; i++) {
for (i = 0; i < op_arm_model->num_counters; i++) {
struct dentry *dir;
char buf[2];
......@@ -43,61 +43,61 @@ static int pmu_create_files(struct super_block *sb, struct dentry *root)
return 0;
}
static int pmu_setup(void)
static int op_arm_setup(void)
{
int ret;
spin_lock(&oprofilefs_lock);
ret = pmu_model->setup_ctrs();
ret = op_arm_model->setup_ctrs();
spin_unlock(&oprofilefs_lock);
return ret;
}
static int pmu_start(void)
static int op_arm_start(void)
{
int ret = -EBUSY;
down(&pmu_sem);
if (!pmu_enabled) {
ret = pmu_model->start();
pmu_enabled = !ret;
down(&op_arm_sem);
if (!op_arm_enabled) {
ret = op_arm_model->start();
op_arm_enabled = !ret;
}
up(&pmu_sem);
up(&op_arm_sem);
return ret;
}
static void pmu_stop(void)
static void op_arm_stop(void)
{
down(&pmu_sem);
if (pmu_enabled)
pmu_model->stop();
pmu_enabled = 0;
up(&pmu_sem);
down(&op_arm_sem);
if (op_arm_enabled)
op_arm_model->stop();
op_arm_enabled = 0;
up(&op_arm_sem);
}
#ifdef CONFIG_PM
static int pmu_suspend(struct sys_device *dev, pm_message_t state)
static int op_arm_suspend(struct sys_device *dev, pm_message_t state)
{
down(&pmu_sem);
if (pmu_enabled)
pmu_model->stop();
up(&pmu_sem);
down(&op_arm_sem);
if (op_arm_enabled)
op_arm_model->stop();
up(&op_arm_sem);
return 0;
}
static int pmu_resume(struct sys_device *dev)
static int op_arm_resume(struct sys_device *dev)
{
down(&pmu_sem);
if (pmu_enabled && pmu_model->start())
pmu_enabled = 0;
up(&pmu_sem);
down(&op_arm_sem);
if (op_arm_enabled && op_arm_model->start())
op_arm_enabled = 0;
up(&op_arm_sem);
return 0;
}
static struct sysdev_class oprofile_sysclass = {
set_kset_name("oprofile"),
.resume = pmu_resume,
.suspend = pmu_suspend,
.resume = op_arm_resume,
.suspend = op_arm_suspend,
};
static struct sys_device device_oprofile = {
......@@ -125,31 +125,31 @@ static void exit_driverfs(void)
#define exit_driverfs() do { } while (0)
#endif /* CONFIG_PM */
int __init pmu_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec)
int __init op_arm_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec)
{
init_MUTEX(&pmu_sem);
init_MUTEX(&op_arm_sem);
if (spec->init() < 0)
return -ENODEV;
pmu_model = spec;
op_arm_model = spec;
init_driverfs();
ops->create_files = pmu_create_files;
ops->setup = pmu_setup;
ops->shutdown = pmu_stop;
ops->start = pmu_start;
ops->stop = pmu_stop;
ops->cpu_type = pmu_model->name;
printk(KERN_INFO "oprofile: using %s PMU\n", spec->name);
ops->create_files = op_arm_create_files;
ops->setup = op_arm_setup;
ops->shutdown = op_arm_stop;
ops->start = op_arm_start;
ops->stop = op_arm_stop;
ops->cpu_type = op_arm_model->name;
printk(KERN_INFO "oprofile: using %s\n", spec->name);
return 0;
}
void pmu_exit(void)
void op_arm_exit(void)
{
if (pmu_model) {
if (op_arm_model) {
exit_driverfs();
pmu_model = NULL;
op_arm_model = NULL;
}
}
......@@ -17,7 +17,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
int ret = -ENODEV;
#ifdef CONFIG_CPU_XSCALE
ret = pmu_init(ops, &op_xscale_spec);
ret = op_arm_init(ops, &op_xscale_spec);
#endif
ops->backtrace = arm_backtrace;
......@@ -28,6 +28,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
void oprofile_arch_exit(void)
{
#ifdef CONFIG_CPU_XSCALE
pmu_exit();
op_arm_exit();
#endif
}
......@@ -26,6 +26,6 @@ extern struct op_arm_model_spec op_xscale_spec;
extern void arm_backtrace(struct pt_regs * const regs, unsigned int depth);
extern int __init pmu_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec);
extern void pmu_exit(void);
extern int __init op_arm_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec);
extern void op_arm_exit(void);
#endif /* OP_ARM_MODEL_H */
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