tracing: Have trace events system open call tracing_open_generic_tr()

Instead of having the trace events system open call open code the taking of
the trace_array descriptor (with trace_array_get()) and then calling
trace_open_generic(), have it use the tracing_open_generic_tr() that does
the combination of the two. This requires making tracing_open_generic_tr()
global.
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 194c2c74
...@@ -4156,7 +4156,7 @@ bool tracing_is_disabled(void) ...@@ -4156,7 +4156,7 @@ bool tracing_is_disabled(void)
* Open and update trace_array ref count. * Open and update trace_array ref count.
* Must have the current trace_array passed to it. * Must have the current trace_array passed to it.
*/ */
static int tracing_open_generic_tr(struct inode *inode, struct file *filp) int tracing_open_generic_tr(struct inode *inode, struct file *filp)
{ {
struct trace_array *tr = inode->i_private; struct trace_array *tr = inode->i_private;
......
...@@ -681,6 +681,7 @@ void tracing_reset_online_cpus(struct trace_buffer *buf); ...@@ -681,6 +681,7 @@ void tracing_reset_online_cpus(struct trace_buffer *buf);
void tracing_reset_current(int cpu); void tracing_reset_current(int cpu);
void tracing_reset_all_online_cpus(void); void tracing_reset_all_online_cpus(void);
int tracing_open_generic(struct inode *inode, struct file *filp); int tracing_open_generic(struct inode *inode, struct file *filp);
int tracing_open_generic_tr(struct inode *inode, struct file *filp);
bool tracing_is_disabled(void); bool tracing_is_disabled(void);
bool tracer_tracing_is_on(struct trace_array *tr); bool tracer_tracing_is_on(struct trace_array *tr);
void tracer_tracing_on(struct trace_array *tr); void tracer_tracing_on(struct trace_array *tr);
......
...@@ -1440,28 +1440,17 @@ static int system_tr_open(struct inode *inode, struct file *filp) ...@@ -1440,28 +1440,17 @@ static int system_tr_open(struct inode *inode, struct file *filp)
struct trace_array *tr = inode->i_private; struct trace_array *tr = inode->i_private;
int ret; int ret;
if (tracing_is_disabled())
return -ENODEV;
if (trace_array_get(tr) < 0)
return -ENODEV;
/* Make a temporary dir that has no system but points to tr */ /* Make a temporary dir that has no system but points to tr */
dir = kzalloc(sizeof(*dir), GFP_KERNEL); dir = kzalloc(sizeof(*dir), GFP_KERNEL);
if (!dir) { if (!dir)
trace_array_put(tr);
return -ENOMEM; return -ENOMEM;
}
dir->tr = tr;
ret = tracing_open_generic(inode, filp); ret = tracing_open_generic_tr(inode, filp);
if (ret < 0) { if (ret < 0) {
trace_array_put(tr);
kfree(dir); kfree(dir);
return ret; return ret;
} }
dir->tr = tr;
filp->private_data = dir; filp->private_data = dir;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment