aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/oprofile/common.c2
-rw-r--r--arch/avr32/oprofile/op_model_avr32.c2
-rw-r--r--arch/mips/oprofile/common.c2
-rw-r--r--arch/powerpc/oprofile/common.c2
-rw-r--r--arch/s390/oprofile/init.c6
-rw-r--r--arch/x86/oprofile/nmi_int.c2
-rw-r--r--arch/x86/oprofile/op_model_amd.c4
-rw-r--r--drivers/oprofile/oprofile_perf.c2
-rw-r--r--drivers/oprofile/oprofile_stats.c4
-rw-r--r--drivers/oprofile/oprofilefs.c15
-rw-r--r--include/linux/oprofile.h3
11 files changed, 21 insertions, 23 deletions
diff --git a/arch/alpha/oprofile/common.c b/arch/alpha/oprofile/common.c
index d79bf68caee2..a44608b697ac 100644
--- a/arch/alpha/oprofile/common.c
+++ b/arch/alpha/oprofile/common.c
@@ -115,7 +115,7 @@ op_axp_create_files(struct dentry *root)
115 char buf[4]; 115 char buf[4];
116 116
117 snprintf(buf, sizeof buf, "%d", i); 117 snprintf(buf, sizeof buf, "%d", i);
118 dir = oprofilefs_mkdir(root->d_sb, root, buf); 118 dir = oprofilefs_mkdir(root, buf);
119 119
120 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); 120 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled);
121 oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); 121 oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event);
diff --git a/arch/avr32/oprofile/op_model_avr32.c b/arch/avr32/oprofile/op_model_avr32.c
index 80a06158da82..7d920a41b441 100644
--- a/arch/avr32/oprofile/op_model_avr32.c
+++ b/arch/avr32/oprofile/op_model_avr32.c
@@ -105,7 +105,7 @@ static int avr32_perf_counter_create_files(struct dentry *root)
105 105
106 for (i = 0; i < NR_counter; i++) { 106 for (i = 0; i < NR_counter; i++) {
107 snprintf(filename, sizeof(filename), "%u", i); 107 snprintf(filename, sizeof(filename), "%u", i);
108 dir = oprofilefs_mkdir(root->d_sb, root, filename); 108 dir = oprofilefs_mkdir(root, filename);
109 109
110 oprofilefs_create_ulong(root->d_sb, dir, "enabled", 110 oprofilefs_create_ulong(root->d_sb, dir, "enabled",
111 &counter[i].enabled); 111 &counter[i].enabled);
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index 7439ae2df05c..755caf04656e 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -42,7 +42,7 @@ static int op_mips_create_files(struct dentry *root)
42 char buf[4]; 42 char buf[4];
43 43
44 snprintf(buf, sizeof buf, "%d", i); 44 snprintf(buf, sizeof buf, "%d", i);
45 dir = oprofilefs_mkdir(root->d_sb, root, buf); 45 dir = oprofilefs_mkdir(root, buf);
46 46
47 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); 47 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled);
48 oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); 48 oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event);
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index addc62317f45..60a286b367fc 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -160,7 +160,7 @@ static int op_powerpc_create_files(struct dentry *root)
160 char buf[4]; 160 char buf[4];
161 161
162 snprintf(buf, sizeof buf, "%d", i); 162 snprintf(buf, sizeof buf, "%d", i);
163 dir = oprofilefs_mkdir(root->d_sb, root, buf); 163 dir = oprofilefs_mkdir(root, buf);
164 164
165 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled); 165 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &ctr[i].enabled);
166 oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event); 166 oprofilefs_create_ulong(root->d_sb, dir, "event", &ctr[i].event);
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index 712d57bb783a..5ae06db7ec58 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -350,7 +350,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root)
350{ 350{
351 struct dentry *dir; 351 struct dentry *dir;
352 352
353 dir = oprofilefs_mkdir(root->d_sb, root, "timer"); 353 dir = oprofilefs_mkdir(root, "timer");
354 if (!dir) 354 if (!dir)
355 return -EINVAL; 355 return -EINVAL;
356 356
@@ -375,7 +375,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root)
375 * and can only be set to 0. 375 * and can only be set to 0.
376 */ 376 */
377 377
378 dir = oprofilefs_mkdir(root->d_sb, root, "0"); 378 dir = oprofilefs_mkdir(root, "0");
379 if (!dir) 379 if (!dir)
380 return -EINVAL; 380 return -EINVAL;
381 381
@@ -395,7 +395,7 @@ static int oprofile_create_hwsampling_files(struct dentry *root)
395 * space tools. The /dev/oprofile/hwsampling fs is 395 * space tools. The /dev/oprofile/hwsampling fs is
396 * provided in that case. 396 * provided in that case.
397 */ 397 */
398 dir = oprofilefs_mkdir(root->d_sb, root, "hwsampling"); 398 dir = oprofilefs_mkdir(root, "hwsampling");
399 if (!dir) 399 if (!dir)
400 return -EINVAL; 400 return -EINVAL;
401 401
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 483f02b8c1a8..8bb2de6e103c 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -420,7 +420,7 @@ static int nmi_create_files(struct dentry *root)
420 continue; 420 continue;
421 421
422 snprintf(buf, sizeof(buf), "%d", i); 422 snprintf(buf, sizeof(buf), "%d", i);
423 dir = oprofilefs_mkdir(root->d_sb, root, buf); 423 dir = oprofilefs_mkdir(root, buf);
424 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled); 424 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled);
425 oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event); 425 oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event);
426 oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count); 426 oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count);
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index 34e16c2fe357..99131435ea32 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -479,7 +479,7 @@ static int setup_ibs_files(struct dentry *root)
479 ibs_config.max_cnt_op = 250000; 479 ibs_config.max_cnt_op = 250000;
480 480
481 if (ibs_caps & IBS_CAPS_FETCHSAM) { 481 if (ibs_caps & IBS_CAPS_FETCHSAM) {
482 dir = oprofilefs_mkdir(root->d_sb, root, "ibs_fetch"); 482 dir = oprofilefs_mkdir(root, "ibs_fetch");
483 oprofilefs_create_ulong(root->d_sb, dir, "enable", 483 oprofilefs_create_ulong(root->d_sb, dir, "enable",
484 &ibs_config.fetch_enabled); 484 &ibs_config.fetch_enabled);
485 oprofilefs_create_ulong(root->d_sb, dir, "max_count", 485 oprofilefs_create_ulong(root->d_sb, dir, "max_count",
@@ -489,7 +489,7 @@ static int setup_ibs_files(struct dentry *root)
489 } 489 }
490 490
491 if (ibs_caps & IBS_CAPS_OPSAM) { 491 if (ibs_caps & IBS_CAPS_OPSAM) {
492 dir = oprofilefs_mkdir(root->d_sb, root, "ibs_op"); 492 dir = oprofilefs_mkdir(root, "ibs_op");
493 oprofilefs_create_ulong(root->d_sb, dir, "enable", 493 oprofilefs_create_ulong(root->d_sb, dir, "enable",
494 &ibs_config.op_enabled); 494 &ibs_config.op_enabled);
495 oprofilefs_create_ulong(root->d_sb, dir, "max_count", 495 oprofilefs_create_ulong(root->d_sb, dir, "max_count",
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
index 52ad942df04e..923a245774fa 100644
--- a/drivers/oprofile/oprofile_perf.c
+++ b/drivers/oprofile/oprofile_perf.c
@@ -147,7 +147,7 @@ static int oprofile_perf_create_files(struct dentry *root)
147 char buf[4]; 147 char buf[4];
148 148
149 snprintf(buf, sizeof buf, "%d", i); 149 snprintf(buf, sizeof buf, "%d", i);
150 dir = oprofilefs_mkdir(root->d_sb, root, buf); 150 dir = oprofilefs_mkdir(root, buf);
151 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled); 151 oprofilefs_create_ulong(root->d_sb, dir, "enabled", &counter_config[i].enabled);
152 oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event); 152 oprofilefs_create_ulong(root->d_sb, dir, "event", &counter_config[i].event);
153 oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count); 153 oprofilefs_create_ulong(root->d_sb, dir, "count", &counter_config[i].count);
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c
index 627dce478311..8cf2fa9710a4 100644
--- a/drivers/oprofile/oprofile_stats.c
+++ b/drivers/oprofile/oprofile_stats.c
@@ -46,14 +46,14 @@ void oprofile_create_stats_files(struct dentry *root)
46 char buf[10]; 46 char buf[10];
47 int i; 47 int i;
48 48
49 dir = oprofilefs_mkdir(root->d_sb, root, "stats"); 49 dir = oprofilefs_mkdir(root, "stats");
50 if (!dir) 50 if (!dir)
51 return; 51 return;
52 52
53 for_each_possible_cpu(i) { 53 for_each_possible_cpu(i) {
54 cpu_buf = &per_cpu(op_cpu_buffer, i); 54 cpu_buf = &per_cpu(op_cpu_buffer, i);
55 snprintf(buf, 10, "cpu%d", i); 55 snprintf(buf, 10, "cpu%d", i);
56 cpudir = oprofilefs_mkdir(root->d_sb, dir, buf); 56 cpudir = oprofilefs_mkdir(dir, buf);
57 57
58 /* Strictly speaking access to these ulongs is racy, 58 /* Strictly speaking access to these ulongs is racy,
59 * but we can't simply lock them, and they are 59 * but we can't simply lock them, and they are
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 2e2dd5ca7211..6a345724637f 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -211,28 +211,27 @@ int oprofilefs_create_file_perm(struct super_block *sb, struct dentry *root,
211} 211}
212 212
213 213
214struct dentry *oprofilefs_mkdir(struct super_block *sb, 214struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name)
215 struct dentry *root, char const *name)
216{ 215{
217 struct dentry *dentry; 216 struct dentry *dentry;
218 struct inode *inode; 217 struct inode *inode;
219 218
220 mutex_lock(&root->d_inode->i_mutex); 219 mutex_lock(&parent->d_inode->i_mutex);
221 dentry = d_alloc_name(root, name); 220 dentry = d_alloc_name(parent, name);
222 if (!dentry) { 221 if (!dentry) {
223 mutex_unlock(&root->d_inode->i_mutex); 222 mutex_unlock(&parent->d_inode->i_mutex);
224 return NULL; 223 return NULL;
225 } 224 }
226 inode = oprofilefs_get_inode(sb, S_IFDIR | 0755); 225 inode = oprofilefs_get_inode(parent->d_sb, S_IFDIR | 0755);
227 if (!inode) { 226 if (!inode) {
228 dput(dentry); 227 dput(dentry);
229 mutex_unlock(&root->d_inode->i_mutex); 228 mutex_unlock(&parent->d_inode->i_mutex);
230 return NULL; 229 return NULL;
231 } 230 }
232 inode->i_op = &simple_dir_inode_operations; 231 inode->i_op = &simple_dir_inode_operations;
233 inode->i_fop = &simple_dir_operations; 232 inode->i_fop = &simple_dir_operations;
234 d_add(dentry, inode); 233 d_add(dentry, inode);
235 mutex_unlock(&root->d_inode->i_mutex); 234 mutex_unlock(&parent->d_inode->i_mutex);
236 return dentry; 235 return dentry;
237} 236}
238 237
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 8a906b4034a7..957877e7a408 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -144,8 +144,7 @@ int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root,
144 char const * name, atomic_t * val); 144 char const * name, atomic_t * val);
145 145
146/** create a directory */ 146/** create a directory */
147struct dentry * oprofilefs_mkdir(struct super_block * sb, struct dentry * root, 147struct dentry *oprofilefs_mkdir(struct dentry *parent, char const *name);
148 char const * name);
149 148
150/** 149/**
151 * Write the given asciz string to the given user buffer @buf, updating *offset 150 * Write the given asciz string to the given user buffer @buf, updating *offset