diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-10-28 09:56:04 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-28 09:56:04 -0400 |
commit | c6b9dafce3e3b434a3e7ffd5072815c03d18cc84 (patch) | |
tree | 111b89d53b0d66d1220d20aaa37f9dbd29658ab4 | |
parent | 55f052341ff75e5815b1f7f4d2d3b69314ea8712 (diff) |
[ARM] 4/4 Combine oprofile common and init code
There is nothing special about having the init code separate from
the common code, so combine the two.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/oprofile/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/oprofile/common.c | 44 | ||||
-rw-r--r-- | arch/arm/oprofile/init.c | 33 |
3 files changed, 29 insertions, 52 deletions
diff --git a/arch/arm/oprofile/Makefile b/arch/arm/oprofile/Makefile index 8ffb523e6c77..6a94e54848fd 100644 --- a/arch/arm/oprofile/Makefile +++ b/arch/arm/oprofile/Makefile | |||
@@ -6,6 +6,6 @@ DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \ | |||
6 | oprofilefs.o oprofile_stats.o \ | 6 | oprofilefs.o oprofile_stats.o \ |
7 | timer_int.o ) | 7 | timer_int.o ) |
8 | 8 | ||
9 | oprofile-y := $(DRIVER_OBJS) init.o backtrace.o | 9 | oprofile-y := $(DRIVER_OBJS) common.o backtrace.o |
10 | oprofile-$(CONFIG_CPU_XSCALE) += common.o op_model_xscale.o | 10 | oprofile-$(CONFIG_CPU_XSCALE) += op_model_xscale.o |
11 | 11 | ||
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c index 7ce6dfa06c85..1415930ceee1 100644 --- a/arch/arm/oprofile/common.c +++ b/arch/arm/oprofile/common.c | |||
@@ -125,27 +125,37 @@ static void exit_driverfs(void) | |||
125 | #define exit_driverfs() do { } while (0) | 125 | #define exit_driverfs() do { } while (0) |
126 | #endif /* CONFIG_PM */ | 126 | #endif /* CONFIG_PM */ |
127 | 127 | ||
128 | int __init op_arm_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec) | 128 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
129 | { | 129 | { |
130 | init_MUTEX(&op_arm_sem); | 130 | struct op_arm_model_spec *spec = NULL; |
131 | 131 | int ret = -ENODEV; | |
132 | if (spec->init() < 0) | 132 | |
133 | return -ENODEV; | 133 | #ifdef CONFIG_CPU_XSCALE |
134 | 134 | spec = &op_xscale_spec; | |
135 | op_arm_model = spec; | 135 | #endif |
136 | init_driverfs(); | 136 | |
137 | ops->create_files = op_arm_create_files; | 137 | if (spec) { |
138 | ops->setup = op_arm_setup; | 138 | init_MUTEX(&op_arm_sem); |
139 | ops->shutdown = op_arm_stop; | 139 | |
140 | ops->start = op_arm_start; | 140 | if (spec->init() < 0) |
141 | ops->stop = op_arm_stop; | 141 | return -ENODEV; |
142 | ops->cpu_type = op_arm_model->name; | 142 | |
143 | printk(KERN_INFO "oprofile: using %s\n", spec->name); | 143 | op_arm_model = spec; |
144 | init_driverfs(); | ||
145 | ops->create_files = op_arm_create_files; | ||
146 | ops->setup = op_arm_setup; | ||
147 | ops->shutdown = op_arm_stop; | ||
148 | ops->start = op_arm_start; | ||
149 | ops->stop = op_arm_stop; | ||
150 | ops->cpu_type = op_arm_model->name; | ||
151 | ops->backtrace = arm_backtrace; | ||
152 | printk(KERN_INFO "oprofile: using %s\n", spec->name); | ||
153 | } | ||
144 | 154 | ||
145 | return 0; | 155 | return ret; |
146 | } | 156 | } |
147 | 157 | ||
148 | void op_arm_exit(void) | 158 | void oprofile_arch_exit(void) |
149 | { | 159 | { |
150 | if (op_arm_model) { | 160 | if (op_arm_model) { |
151 | exit_driverfs(); | 161 | exit_driverfs(); |
diff --git a/arch/arm/oprofile/init.c b/arch/arm/oprofile/init.c deleted file mode 100644 index ccd8c54934a2..000000000000 --- a/arch/arm/oprofile/init.c +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /** | ||
2 | * @file init.c | ||
3 | * | ||
4 | * @remark Copyright 2004 Oprofile Authors | ||
5 | * @remark Read the file COPYING | ||
6 | * | ||
7 | * @author Zwane Mwaikambo | ||
8 | */ | ||
9 | |||
10 | #include <linux/oprofile.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include "op_arm_model.h" | ||
14 | |||
15 | int __init oprofile_arch_init(struct oprofile_operations *ops) | ||
16 | { | ||
17 | int ret = -ENODEV; | ||
18 | |||
19 | #ifdef CONFIG_CPU_XSCALE | ||
20 | ret = op_arm_init(ops, &op_xscale_spec); | ||
21 | #endif | ||
22 | |||
23 | ops->backtrace = arm_backtrace; | ||
24 | |||
25 | return ret; | ||
26 | } | ||
27 | |||
28 | void oprofile_arch_exit(void) | ||
29 | { | ||
30 | #ifdef CONFIG_CPU_XSCALE | ||
31 | op_arm_exit(); | ||
32 | #endif | ||
33 | } | ||