Commit eb7d035c authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

tracepoint: Simplify tracepoint module search

Instead of copying the num_tracepoints and tracepoints_ptrs from
the module structure to the tp_mod structure, which only uses it to
find the module associated to tracepoints of modules that are coming
and going, simply copy the pointer to the module struct to the tracepoint
tp_module structure.

Also removed un-needed brackets around an if statement.

Link: http://lkml.kernel.org/r/20140408201705.4dad2c4a@gandalf.local.homeAcked-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent de7b2973
...@@ -47,8 +47,7 @@ for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv), ...@@ -47,8 +47,7 @@ for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv),
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
struct tp_module { struct tp_module {
struct list_head list; struct list_head list;
unsigned int num_tracepoints; struct module *mod;
struct tracepoint * const *tracepoints_ptrs;
}; };
bool trace_module_has_bad_taint(struct module *mod); bool trace_module_has_bad_taint(struct module *mod);
......
...@@ -374,8 +374,7 @@ static int tracepoint_module_coming(struct module *mod) ...@@ -374,8 +374,7 @@ static int tracepoint_module_coming(struct module *mod)
ret = -ENOMEM; ret = -ENOMEM;
goto end; goto end;
} }
tp_mod->num_tracepoints = mod->num_tracepoints; tp_mod->mod = mod;
tp_mod->tracepoints_ptrs = mod->tracepoints_ptrs;
list_add_tail(&tp_mod->list, &tracepoint_module_list); list_add_tail(&tp_mod->list, &tracepoint_module_list);
blocking_notifier_call_chain(&tracepoint_notify_list, blocking_notifier_call_chain(&tracepoint_notify_list,
MODULE_STATE_COMING, tp_mod); MODULE_STATE_COMING, tp_mod);
...@@ -393,7 +392,7 @@ static void tracepoint_module_going(struct module *mod) ...@@ -393,7 +392,7 @@ static void tracepoint_module_going(struct module *mod)
mutex_lock(&tracepoint_module_list_mutex); mutex_lock(&tracepoint_module_list_mutex);
list_for_each_entry(tp_mod, &tracepoint_module_list, list) { list_for_each_entry(tp_mod, &tracepoint_module_list, list) {
if (tp_mod->tracepoints_ptrs == mod->tracepoints_ptrs) { if (tp_mod->mod == mod) {
blocking_notifier_call_chain(&tracepoint_notify_list, blocking_notifier_call_chain(&tracepoint_notify_list,
MODULE_STATE_GOING, tp_mod); MODULE_STATE_GOING, tp_mod);
list_del(&tp_mod->list); list_del(&tp_mod->list);
...@@ -447,9 +446,9 @@ static __init int init_tracepoints(void) ...@@ -447,9 +446,9 @@ static __init int init_tracepoints(void)
int ret; int ret;
ret = register_module_notifier(&tracepoint_module_nb); ret = register_module_notifier(&tracepoint_module_nb);
if (ret) { if (ret)
pr_warning("Failed to register tracepoint module enter notifier\n"); pr_warning("Failed to register tracepoint module enter notifier\n");
}
return ret; return ret;
} }
__initcall(init_tracepoints); __initcall(init_tracepoints);
......
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