Skip to contentSkip to conversation

tracing: teach to use pr_warn_once

PATCH In review zhangwei(Jovi) 1 participant 1 message Mar 11, 2013 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/13 tracing: teach to use pr_warn_once

use pr_warn_once, instead implement it by our own.

---
 kernel/trace/trace.c |   17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
kernel/trace/trace.c +4 -13
index c2e2c23..11cd56b 100644
@@ -4588,8 +4588,6 @@ static struct dentry *d_tracer;
 
 struct dentry *tracing_init_dentry(void)
 {
-	static int once;
-
 	if (d_tracer)
 		return d_tracer;
 
@@ -4598,11 +4596,8 @@ struct dentry *tracing_init_dentry(void)
 
 	d_tracer = debugfs_create_dir("tracing", NULL);
 
-	if (!d_tracer && !once) {
-		once = 1;
-		pr_warning("Could not create debugfs directory 'tracing'\n");
-		return NULL;
-	}
+	if (!d_tracer)
+		pr_warn_once("Could not create debugfs directory 'tracing'\n");
 
 	return d_tracer;
 }
@@ -4611,7 +4606,6 @@ static struct dentry *d_percpu;
 
 static struct dentry *tracing_dentry_percpu(void)
 {
-	static int once;
 	struct dentry *d_tracer;
 
 	if (d_percpu)
@@ -4624,11 +4618,8 @@ static struct dentry *tracing_dentry_percpu(void)
 
 	d_percpu = debugfs_create_dir("per_cpu", d_tracer);
 
-	if (!d_percpu && !once) {
-		once = 1;
-		pr_warning("Could not create debugfs directory 'per_cpu'\n");
-		return NULL;
-	}
+	if (!d_percpu)
+		pr_warn_once("Could not create debugfs directory 'per_cpu'\n");
 
 	return d_percpu;
 }
Signature · 1 line
1.7.9.7