LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/2] tracing: Some clean ups that will help tracefs
@ 2015-01-23 21:50 Steven Rostedt
  2015-01-23 21:50 ` [PATCH 1/2] tracing: Remove unneeded includes of debugfs.h and fs.h Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steven Rostedt @ 2015-01-23 21:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

I added these two patches before applying my tracefs changes.
I'm still waiting on review from Al or Greg from tracefs, but these
fixes are just some clean ups that are unrelated. But should go into
linux-next now anyway.

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: 14a5ae40f0def33a422a45b2ed09198adb7bf11c


Steven Rostedt (Red Hat) (2):
      tracing: Remove unneeded includes of debugfs.h and fs.h
      tracing: Use IS_ERR() check for return value of tracing_init_dentry()

----
 kernel/trace/ftrace.c                | 2 +-
 kernel/trace/ring_buffer.c           | 2 --
 kernel/trace/trace.c                 | 8 ++++----
 kernel/trace/trace_branch.c          | 1 -
 kernel/trace/trace_events.c          | 2 +-
 kernel/trace/trace_export.c          | 2 --
 kernel/trace/trace_functions_graph.c | 2 +-
 kernel/trace/trace_irqsoff.c         | 2 --
 kernel/trace/trace_kprobe.c          | 2 +-
 kernel/trace/trace_nop.c             | 2 --
 kernel/trace/trace_printk.c          | 4 +---
 kernel/trace/trace_sched_switch.c    | 2 --
 kernel/trace/trace_sched_wakeup.c    | 2 --
 kernel/trace/trace_stack.c           | 4 +---
 kernel/trace/trace_stat.c            | 2 +-
 kernel/trace/trace_uprobe.c          | 2 +-
 16 files changed, 12 insertions(+), 29 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] tracing: Remove unneeded includes of debugfs.h and fs.h
  2015-01-23 21:50 [PATCH 0/2] tracing: Some clean ups that will help tracefs Steven Rostedt
@ 2015-01-23 21:50 ` Steven Rostedt
  2015-01-23 21:50 ` [PATCH 2/2] tracing: Use IS_ERR() check for return value of tracing_init_dentry() Steven Rostedt
  2015-01-23 21:57 ` [PATCH 0/2] tracing: Some clean ups that will help tracefs Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2015-01-23 21:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

[-- Attachment #1: 0001-tracing-Remove-unneeded-includes-of-debugfs.h-and-fs.patch --]
[-- Type: text/plain, Size: 4742 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

The creation of tracing files and directories is for the most part
encapsulated in helper functions in trace.c. Other files do not need to
include debugfs.h or fs.h, as they may have needed to in the past.

Remove them from the files that do not need them.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ring_buffer.c        | 2 --
 kernel/trace/trace_branch.c       | 1 -
 kernel/trace/trace_export.c       | 2 --
 kernel/trace/trace_irqsoff.c      | 2 --
 kernel/trace/trace_nop.c          | 2 --
 kernel/trace/trace_printk.c       | 2 --
 kernel/trace/trace_sched_switch.c | 2 --
 kernel/trace/trace_sched_wakeup.c | 2 --
 kernel/trace/trace_stack.c        | 2 --
 9 files changed, 17 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 7a4104cb95cb..96079180de3d 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -9,7 +9,6 @@
 #include <linux/trace_seq.h>
 #include <linux/spinlock.h>
 #include <linux/irq_work.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 #include <linux/kthread.h>	/* for self test */
@@ -23,7 +22,6 @@
 #include <linux/hash.h>
 #include <linux/list.h>
 #include <linux/cpu.h>
-#include <linux/fs.h>
 
 #include <asm/local.h>
 
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index 7d6e2afde669..57cbf1efdd44 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -7,7 +7,6 @@
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
 #include <linux/irqflags.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/ftrace.h>
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index d4ddde28a81a..12e2b99be862 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -6,12 +6,10 @@
 #include <linux/stringify.h>
 #include <linux/kallsyms.h>
 #include <linux/seq_file.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/fs.h>
 
 #include "trace_output.h"
 
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 9bb104f748d0..8523ea345f2b 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -10,11 +10,9 @@
  *  Copyright (C) 2004 Nadia Yvette Chambers
  */
 #include <linux/kallsyms.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/ftrace.h>
-#include <linux/fs.h>
 
 #include "trace.h"
 
diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c
index fcf0a9e48916..8bb2071474dd 100644
--- a/kernel/trace/trace_nop.c
+++ b/kernel/trace/trace_nop.c
@@ -6,8 +6,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/debugfs.h>
 #include <linux/ftrace.h>
 
 #include "trace.h"
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index c4e70b6bd7fa..7ee4b5cc1ce5 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -5,7 +5,6 @@
  *
  */
 #include <linux/seq_file.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/ftrace.h>
@@ -15,7 +14,6 @@
 #include <linux/ctype.h>
 #include <linux/list.h>
 #include <linux/slab.h>
-#include <linux/fs.h>
 
 #include "trace.h"
 
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 2e293beb186e..419ca37e72c9 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -5,8 +5,6 @@
  *
  */
 #include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/debugfs.h>
 #include <linux/kallsyms.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index 8fb84b362816..d6e1003724e9 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -10,8 +10,6 @@
  *  Copyright (C) 2004 Nadia Yvette Chambers
  */
 #include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/debugfs.h>
 #include <linux/kallsyms.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 16eddb308c33..e80927b88eb0 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -7,12 +7,10 @@
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
 #include <linux/uaccess.h>
-#include <linux/debugfs.h>
 #include <linux/ftrace.h>
 #include <linux/module.h>
 #include <linux/sysctl.h>
 #include <linux/init.h>
-#include <linux/fs.h>
 
 #include <asm/setup.h>
 
-- 
2.1.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] tracing: Use IS_ERR() check for return value of tracing_init_dentry()
  2015-01-23 21:50 [PATCH 0/2] tracing: Some clean ups that will help tracefs Steven Rostedt
  2015-01-23 21:50 ` [PATCH 1/2] tracing: Remove unneeded includes of debugfs.h and fs.h Steven Rostedt
@ 2015-01-23 21:50 ` Steven Rostedt
  2015-01-23 21:57 ` [PATCH 0/2] tracing: Some clean ups that will help tracefs Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2015-01-23 21:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

[-- Attachment #1: 0002-tracing-Use-IS_ERR-check-for-return-value-of-tracing.patch --]
[-- Type: text/plain, Size: 5367 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

tracing_init_dentry() will soon return NULL as a valid pointer for the
top level tracing directroy. NULL can not be used as an error value.
Instead, switch to ERR_PTR() and check the return status with
IS_ERR().

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/ftrace.c                | 2 +-
 kernel/trace/trace.c                 | 8 ++++----
 kernel/trace/trace_events.c          | 2 +-
 kernel/trace/trace_functions_graph.c | 2 +-
 kernel/trace/trace_kprobe.c          | 2 +-
 kernel/trace/trace_printk.c          | 2 +-
 kernel/trace/trace_stack.c           | 2 +-
 kernel/trace/trace_stat.c            | 2 +-
 kernel/trace/trace_uprobe.c          | 2 +-
 9 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 929a733d302e..80c9d34540dd 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5419,7 +5419,7 @@ static __init int ftrace_init_debugfs(void)
 	struct dentry *d_tracer;
 
 	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return 0;
 
 	ftrace_init_dyn_debugfs(d_tracer);
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7669b1f3234e..acd27555dc5b 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5820,7 +5820,7 @@ struct dentry *tracing_init_dentry_tr(struct trace_array *tr)
 		return tr->dir;
 
 	if (!debugfs_initialized())
-		return NULL;
+		return ERR_PTR(-ENODEV);
 
 	if (tr->flags & TRACE_ARRAY_FL_GLOBAL)
 		tr->dir = debugfs_create_dir("tracing", NULL);
@@ -5844,7 +5844,7 @@ static struct dentry *tracing_dentry_percpu(struct trace_array *tr, int cpu)
 		return tr->percpu_dir;
 
 	d_tracer = tracing_init_dentry_tr(tr);
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return NULL;
 
 	tr->percpu_dir = debugfs_create_dir("per_cpu", d_tracer);
@@ -6047,7 +6047,7 @@ static struct dentry *trace_options_init_dentry(struct trace_array *tr)
 		return tr->options;
 
 	d_tracer = tracing_init_dentry_tr(tr);
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return NULL;
 
 	tr->options = debugfs_create_dir("options", d_tracer);
@@ -6538,7 +6538,7 @@ static __init int tracer_init_debugfs(void)
 	trace_access_lock_init();
 
 	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return 0;
 
 	init_tracer_debugfs(&global_trace, d_tracer);
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 366a78a3e61e..4ff8c1394017 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2490,7 +2490,7 @@ static __init int event_trace_init(void)
 		return -ENODEV;
 
 	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return 0;
 
 	entry = debugfs_create_file("available_events", 0444, d_tracer,
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index ba476009e5de..2d25ad1526bb 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -1437,7 +1437,7 @@ static __init int init_graph_debugfs(void)
 	struct dentry *d_tracer;
 
 	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return 0;
 
 	trace_create_file("max_graph_depth", 0644, d_tracer,
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 5edb518be345..b4a00def88f5 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1320,7 +1320,7 @@ static __init int init_kprobe_trace(void)
 		return -EINVAL;
 
 	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return 0;
 
 	entry = debugfs_create_file("kprobe_events", 0644, d_tracer,
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 7ee4b5cc1ce5..36c1455b7567 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -347,7 +347,7 @@ static __init int init_trace_printk_function_export(void)
 	struct dentry *d_tracer;
 
 	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return 0;
 
 	trace_create_file("printk_formats", 0444, d_tracer,
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index e80927b88eb0..c3e4fcfddd45 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -460,7 +460,7 @@ static __init int stack_trace_init(void)
 	struct dentry *d_tracer;
 
 	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return 0;
 
 	trace_create_file("stack_max_size", 0644, d_tracer,
diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
index 7af67360b330..75e19e86c954 100644
--- a/kernel/trace/trace_stat.c
+++ b/kernel/trace/trace_stat.c
@@ -276,7 +276,7 @@ static int tracing_stat_init(void)
 	struct dentry *d_tracing;
 
 	d_tracing = tracing_init_dentry();
-	if (!d_tracing)
+	if (IS_ERR(d_tracing))
 		return 0;
 
 	stat_dir = debugfs_create_dir("trace_stat", d_tracing);
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 8520acc34b18..5f0eba9e5e6b 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -1321,7 +1321,7 @@ static __init int init_uprobe_trace(void)
 	struct dentry *d_tracer;
 
 	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
+	if (IS_ERR(d_tracer))
 		return 0;
 
 	trace_create_file("uprobe_events", 0644, d_tracer,
-- 
2.1.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] tracing: Some clean ups that will help tracefs
  2015-01-23 21:50 [PATCH 0/2] tracing: Some clean ups that will help tracefs Steven Rostedt
  2015-01-23 21:50 ` [PATCH 1/2] tracing: Remove unneeded includes of debugfs.h and fs.h Steven Rostedt
  2015-01-23 21:50 ` [PATCH 2/2] tracing: Use IS_ERR() check for return value of tracing_init_dentry() Steven Rostedt
@ 2015-01-23 21:57 ` Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2015-01-23 21:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

On Fri, 23 Jan 2015 16:50:10 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> I added these two patches before applying my tracefs changes.
> I'm still waiting on review from Al or Greg from tracefs, but these
> fixes are just some clean ups that are unrelated. But should go into
> linux-next now anyway.
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
> for-next

I forgot to add my [for-next] in the subject. But I think it's pretty
obvious (I hope).

-- Steve

> 
> Head SHA1: 14a5ae40f0def33a422a45b2ed09198adb7bf11c
> 
> 
> Steven Rostedt (Red Hat) (2):
>       tracing: Remove unneeded includes of debugfs.h and fs.h
>       tracing: Use IS_ERR() check for return value of tracing_init_dentry()
> 
> ----
>  kernel/trace/ftrace.c                | 2 +-
>  kernel/trace/ring_buffer.c           | 2 --
>  kernel/trace/trace.c                 | 8 ++++----
>  kernel/trace/trace_branch.c          | 1 -
>  kernel/trace/trace_events.c          | 2 +-
>  kernel/trace/trace_export.c          | 2 --
>  kernel/trace/trace_functions_graph.c | 2 +-
>  kernel/trace/trace_irqsoff.c         | 2 --
>  kernel/trace/trace_kprobe.c          | 2 +-
>  kernel/trace/trace_nop.c             | 2 --
>  kernel/trace/trace_printk.c          | 4 +---
>  kernel/trace/trace_sched_switch.c    | 2 --
>  kernel/trace/trace_sched_wakeup.c    | 2 --
>  kernel/trace/trace_stack.c           | 4 +---
>  kernel/trace/trace_stat.c            | 2 +-
>  kernel/trace/trace_uprobe.c          | 2 +-
>  16 files changed, 12 insertions(+), 29 deletions(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-23 21:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 21:50 [PATCH 0/2] tracing: Some clean ups that will help tracefs Steven Rostedt
2015-01-23 21:50 ` [PATCH 1/2] tracing: Remove unneeded includes of debugfs.h and fs.h Steven Rostedt
2015-01-23 21:50 ` [PATCH 2/2] tracing: Use IS_ERR() check for return value of tracing_init_dentry() Steven Rostedt
2015-01-23 21:57 ` [PATCH 0/2] tracing: Some clean ups that will help tracefs Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).