diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-10-28 09:51:15 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-28 09:51:15 -0400 |
commit | b5893c56ca7e664aef010a71c2638db768d4e996 (patch) | |
tree | 0e7478849d0f37fbf199fe2c2005828492a280c4 /arch/arm | |
parent | 90072059d2963dec237ae0cf49831ef77ddb5739 (diff) |
[ARM] 1/4 Move oprofile driver model code
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/oprofile/common.c | 99 |
1 files changed, 47 insertions, 52 deletions
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c index e57dde882898..5b1d752edbc3 100644 --- a/arch/arm/oprofile/common.c +++ b/arch/arm/oprofile/common.c | |||
@@ -10,8 +10,8 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/oprofile.h> | 11 | #include <linux/oprofile.h> |
12 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
13 | #include <asm/semaphore.h> | ||
14 | #include <linux/sysdev.h> | 13 | #include <linux/sysdev.h> |
14 | #include <asm/semaphore.h> | ||
15 | 15 | ||
16 | #include "op_counter.h" | 16 | #include "op_counter.h" |
17 | #include "op_arm_model.h" | 17 | #include "op_arm_model.h" |
@@ -20,57 +20,6 @@ static struct op_arm_model_spec *pmu_model; | |||
20 | static int pmu_enabled; | 20 | static int pmu_enabled; |
21 | static struct semaphore pmu_sem; | 21 | static struct semaphore pmu_sem; |
22 | 22 | ||
23 | static int pmu_start(void); | ||
24 | static int pmu_setup(void); | ||
25 | static void pmu_stop(void); | ||
26 | static int pmu_create_files(struct super_block *, struct dentry *); | ||
27 | |||
28 | #ifdef CONFIG_PM | ||
29 | static int pmu_suspend(struct sys_device *dev, pm_message_t state) | ||
30 | { | ||
31 | if (pmu_enabled) | ||
32 | pmu_stop(); | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static int pmu_resume(struct sys_device *dev) | ||
37 | { | ||
38 | if (pmu_enabled) | ||
39 | pmu_start(); | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | static struct sysdev_class oprofile_sysclass = { | ||
44 | set_kset_name("oprofile"), | ||
45 | .resume = pmu_resume, | ||
46 | .suspend = pmu_suspend, | ||
47 | }; | ||
48 | |||
49 | static struct sys_device device_oprofile = { | ||
50 | .id = 0, | ||
51 | .cls = &oprofile_sysclass, | ||
52 | }; | ||
53 | |||
54 | static int __init init_driverfs(void) | ||
55 | { | ||
56 | int ret; | ||
57 | |||
58 | if (!(ret = sysdev_class_register(&oprofile_sysclass))) | ||
59 | ret = sysdev_register(&device_oprofile); | ||
60 | |||
61 | return ret; | ||
62 | } | ||
63 | |||
64 | static void exit_driverfs(void) | ||
65 | { | ||
66 | sysdev_unregister(&device_oprofile); | ||
67 | sysdev_class_unregister(&oprofile_sysclass); | ||
68 | } | ||
69 | #else | ||
70 | #define init_driverfs() do { } while (0) | ||
71 | #define exit_driverfs() do { } while (0) | ||
72 | #endif /* CONFIG_PM */ | ||
73 | |||
74 | struct op_counter_config counter_config[OP_MAX_COUNTER]; | 23 | struct op_counter_config counter_config[OP_MAX_COUNTER]; |
75 | 24 | ||
76 | static int pmu_create_files(struct super_block *sb, struct dentry *root) | 25 | static int pmu_create_files(struct super_block *sb, struct dentry *root) |
@@ -126,6 +75,52 @@ static void pmu_stop(void) | |||
126 | up(&pmu_sem); | 75 | up(&pmu_sem); |
127 | } | 76 | } |
128 | 77 | ||
78 | #ifdef CONFIG_PM | ||
79 | static int pmu_suspend(struct sys_device *dev, pm_message_t state) | ||
80 | { | ||
81 | if (pmu_enabled) | ||
82 | pmu_stop(); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static int pmu_resume(struct sys_device *dev) | ||
87 | { | ||
88 | if (pmu_enabled) | ||
89 | pmu_start(); | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static struct sysdev_class oprofile_sysclass = { | ||
94 | set_kset_name("oprofile"), | ||
95 | .resume = pmu_resume, | ||
96 | .suspend = pmu_suspend, | ||
97 | }; | ||
98 | |||
99 | static struct sys_device device_oprofile = { | ||
100 | .id = 0, | ||
101 | .cls = &oprofile_sysclass, | ||
102 | }; | ||
103 | |||
104 | static int __init init_driverfs(void) | ||
105 | { | ||
106 | int ret; | ||
107 | |||
108 | if (!(ret = sysdev_class_register(&oprofile_sysclass))) | ||
109 | ret = sysdev_register(&device_oprofile); | ||
110 | |||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | static void exit_driverfs(void) | ||
115 | { | ||
116 | sysdev_unregister(&device_oprofile); | ||
117 | sysdev_class_unregister(&oprofile_sysclass); | ||
118 | } | ||
119 | #else | ||
120 | #define init_driverfs() do { } while (0) | ||
121 | #define exit_driverfs() do { } while (0) | ||
122 | #endif /* CONFIG_PM */ | ||
123 | |||
129 | int __init pmu_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec) | 124 | int __init pmu_init(struct oprofile_operations *ops, struct op_arm_model_spec *spec) |
130 | { | 125 | { |
131 | init_MUTEX(&pmu_sem); | 126 | init_MUTEX(&pmu_sem); |