Skip to content

Commit aa07d71

Browse files
committed
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: Steven Rostedt (VMware) <[email protected]>
1 parent 194c2c7 commit aa07d71

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

kernel/trace/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4156,7 +4156,7 @@ bool tracing_is_disabled(void)
41564156
* Open and update trace_array ref count.
41574157
* Must have the current trace_array passed to it.
41584158
*/
4159-
static int tracing_open_generic_tr(struct inode *inode, struct file *filp)
4159+
int tracing_open_generic_tr(struct inode *inode, struct file *filp)
41604160
{
41614161
struct trace_array *tr = inode->i_private;
41624162

kernel/trace/trace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ void tracing_reset_online_cpus(struct trace_buffer *buf);
681681
void tracing_reset_current(int cpu);
682682
void tracing_reset_all_online_cpus(void);
683683
int tracing_open_generic(struct inode *inode, struct file *filp);
684+
int tracing_open_generic_tr(struct inode *inode, struct file *filp);
684685
bool tracing_is_disabled(void);
685686
bool tracer_tracing_is_on(struct trace_array *tr);
686687
void tracer_tracing_on(struct trace_array *tr);

kernel/trace/trace_events.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,28 +1440,17 @@ static int system_tr_open(struct inode *inode, struct file *filp)
14401440
struct trace_array *tr = inode->i_private;
14411441
int ret;
14421442

1443-
if (tracing_is_disabled())
1444-
return -ENODEV;
1445-
1446-
if (trace_array_get(tr) < 0)
1447-
return -ENODEV;
1448-
14491443
/* Make a temporary dir that has no system but points to tr */
14501444
dir = kzalloc(sizeof(*dir), GFP_KERNEL);
1451-
if (!dir) {
1452-
trace_array_put(tr);
1445+
if (!dir)
14531446
return -ENOMEM;
1454-
}
1455-
1456-
dir->tr = tr;
14571447

1458-
ret = tracing_open_generic(inode, filp);
1448+
ret = tracing_open_generic_tr(inode, filp);
14591449
if (ret < 0) {
1460-
trace_array_put(tr);
14611450
kfree(dir);
14621451
return ret;
14631452
}
1464-
1453+
dir->tr = tr;
14651454
filp->private_data = dir;
14661455

14671456
return 0;

0 commit comments

Comments
 (0)