Skip to content

Commit 620a30e

Browse files
oleg-nesterovrostedt
authored andcommitted
tracing: Don't pass file_operations array to event_create_dir()
Now that event_create_dir() and __trace_add_new_event() always use the same file_operations we can kill these arguments and simplify the code. Link: http://lkml.kernel.org/r/20130731173135.GA31040@redhat.com Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 779c5e3 commit 620a30e

1 file changed

Lines changed: 12 additions & 34 deletions

File tree

‎kernel/trace/trace_events.c‎

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,12 +1489,7 @@ event_subsystem_dir(struct trace_array *tr, const char *name,
14891489
}
14901490

14911491
static int
1492-
event_create_dir(struct dentry *parent,
1493-
struct ftrace_event_file *file,
1494-
const struct file_operations *id,
1495-
const struct file_operations *enable,
1496-
const struct file_operations *filter,
1497-
const struct file_operations *format)
1492+
event_create_dir(struct dentry *parent, struct ftrace_event_file *file)
14981493
{
14991494
struct ftrace_event_call *call = file->event_call;
15001495
struct trace_array *tr = file->tr;
@@ -1522,12 +1517,13 @@ event_create_dir(struct dentry *parent,
15221517

15231518
if (call->class->reg && !(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
15241519
trace_create_file("enable", 0644, file->dir, file,
1525-
enable);
1520+
&ftrace_enable_fops);
15261521

15271522
#ifdef CONFIG_PERF_EVENTS
15281523
if (call->event.type && call->class->reg)
15291524
trace_create_file("id", 0444, file->dir,
1530-
(void *)(long)call->event.type, id);
1525+
(void *)(long)call->event.type,
1526+
&ftrace_event_id_fops);
15311527
#endif
15321528

15331529
/*
@@ -1544,10 +1540,10 @@ event_create_dir(struct dentry *parent,
15441540
}
15451541
}
15461542
trace_create_file("filter", 0644, file->dir, call,
1547-
filter);
1543+
&ftrace_event_filter_fops);
15481544

15491545
trace_create_file("format", 0444, file->dir, call,
1550-
format);
1546+
&ftrace_event_format_fops);
15511547

15521548
return 0;
15531549
}
@@ -1648,20 +1644,15 @@ trace_create_new_event(struct ftrace_event_call *call,
16481644

16491645
/* Add an event to a trace directory */
16501646
static int
1651-
__trace_add_new_event(struct ftrace_event_call *call,
1652-
struct trace_array *tr,
1653-
const struct file_operations *id,
1654-
const struct file_operations *enable,
1655-
const struct file_operations *filter,
1656-
const struct file_operations *format)
1647+
__trace_add_new_event(struct ftrace_event_call *call, struct trace_array *tr)
16571648
{
16581649
struct ftrace_event_file *file;
16591650

16601651
file = trace_create_new_event(call, tr);
16611652
if (!file)
16621653
return -ENOMEM;
16631654

1664-
return event_create_dir(tr->event_dir, file, id, enable, filter, format);
1655+
return event_create_dir(tr->event_dir, file);
16651656
}
16661657

16671658
/*
@@ -1845,11 +1836,7 @@ __trace_add_event_dirs(struct trace_array *tr)
18451836
int ret;
18461837

18471838
list_for_each_entry(call, &ftrace_events, list) {
1848-
ret = __trace_add_new_event(call, tr,
1849-
&ftrace_event_id_fops,
1850-
&ftrace_enable_fops,
1851-
&ftrace_event_filter_fops,
1852-
&ftrace_event_format_fops);
1839+
ret = __trace_add_new_event(call, tr);
18531840
if (ret < 0)
18541841
pr_warning("Could not create directory for event %s\n",
18551842
call->name);
@@ -2157,11 +2144,7 @@ __trace_early_add_event_dirs(struct trace_array *tr)
21572144

21582145

21592146
list_for_each_entry(file, &tr->events, list) {
2160-
ret = event_create_dir(tr->event_dir, file,
2161-
&ftrace_event_id_fops,
2162-
&ftrace_enable_fops,
2163-
&ftrace_event_filter_fops,
2164-
&ftrace_event_format_fops);
2147+
ret = event_create_dir(tr->event_dir, file);
21652148
if (ret < 0)
21662149
pr_warning("Could not create directory for event %s\n",
21672150
file->event_call->name);
@@ -2206,13 +2189,8 @@ static void __add_event_to_tracers(struct ftrace_event_call *call)
22062189
{
22072190
struct trace_array *tr;
22082191

2209-
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
2210-
__trace_add_new_event(call, tr,
2211-
&ftrace_event_id_fops,
2212-
&ftrace_enable_fops,
2213-
&ftrace_event_filter_fops,
2214-
&ftrace_event_format_fops);
2215-
}
2192+
list_for_each_entry(tr, &ftrace_trace_arrays, list)
2193+
__trace_add_new_event(call, tr);
22162194
}
22172195

22182196
static struct notifier_block trace_module_nb = {

0 commit comments

Comments
 (0)