aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/oprofile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/oprofile')
-rw-r--r--arch/arm/oprofile/common.c11
-rw-r--r--arch/arm/oprofile/op_counter.h2
2 files changed, 10 insertions, 3 deletions
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index b57b6d11c9fb..de72902ad0ca 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -10,6 +10,7 @@
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 <linux/slab.h>
13#include <linux/sysdev.h> 14#include <linux/sysdev.h>
14#include <linux/mutex.h> 15#include <linux/mutex.h>
15 16
@@ -20,7 +21,7 @@ static struct op_arm_model_spec *op_arm_model;
20static int op_arm_enabled; 21static int op_arm_enabled;
21static DEFINE_MUTEX(op_arm_mutex); 22static DEFINE_MUTEX(op_arm_mutex);
22 23
23struct op_counter_config counter_config[OP_MAX_COUNTER]; 24struct op_counter_config *counter_config;
24 25
25static int op_arm_create_files(struct super_block *sb, struct dentry *root) 26static int op_arm_create_files(struct super_block *sb, struct dentry *root)
26{ 27{
@@ -28,7 +29,7 @@ static int op_arm_create_files(struct super_block *sb, struct dentry *root)
28 29
29 for (i = 0; i < op_arm_model->num_counters; i++) { 30 for (i = 0; i < op_arm_model->num_counters; i++) {
30 struct dentry *dir; 31 struct dentry *dir;
31 char buf[2]; 32 char buf[4];
32 33
33 snprintf(buf, sizeof buf, "%d", i); 34 snprintf(buf, sizeof buf, "%d", i);
34 dir = oprofilefs_mkdir(sb, root, buf); 35 dir = oprofilefs_mkdir(sb, root, buf);
@@ -139,6 +140,11 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
139 if (ret < 0) 140 if (ret < 0)
140 return ret; 141 return ret;
141 142
143 counter_config = kmalloc(sizeof(struct op_counter_config) * spec->num_counters,
144 GFP_KERNEL);
145 if (!counter_config)
146 return -ENOMEM;
147
142 op_arm_model = spec; 148 op_arm_model = spec;
143 init_driverfs(); 149 init_driverfs();
144 ops->create_files = op_arm_create_files; 150 ops->create_files = op_arm_create_files;
@@ -160,4 +166,5 @@ void oprofile_arch_exit(void)
160 exit_driverfs(); 166 exit_driverfs();
161 op_arm_model = NULL; 167 op_arm_model = NULL;
162 } 168 }
169 kfree(counter_config);
163} 170}
diff --git a/arch/arm/oprofile/op_counter.h b/arch/arm/oprofile/op_counter.h
index 153c1d467f24..8c5351d751cf 100644
--- a/arch/arm/oprofile/op_counter.h
+++ b/arch/arm/oprofile/op_counter.h
@@ -24,6 +24,6 @@ struct op_counter_config {
24 unsigned long user; 24 unsigned long user;
25}; 25};
26 26
27extern struct op_counter_config counter_config[]; 27extern struct op_counter_config *counter_config;
28 28
29#endif /* OP_COUNTER_H */ 29#endif /* OP_COUNTER_H */