Skip to content

Commit eb7d035

Browse files
committed
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.home Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent de7b297 commit eb7d035

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎include/linux/tracepoint.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv),
4747
#ifdef CONFIG_MODULES
4848
struct tp_module {
4949
struct list_head list;
50-
unsigned int num_tracepoints;
51-
struct tracepoint * const *tracepoints_ptrs;
50+
struct module *mod;
5251
};
5352

5453
bool trace_module_has_bad_taint(struct module *mod);

‎kernel/tracepoint.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,7 @@ static int tracepoint_module_coming(struct module *mod)
374374
ret = -ENOMEM;
375375
goto end;
376376
}
377-
tp_mod->num_tracepoints = mod->num_tracepoints;
378-
tp_mod->tracepoints_ptrs = mod->tracepoints_ptrs;
377+
tp_mod->mod = mod;
379378
list_add_tail(&tp_mod->list, &tracepoint_module_list);
380379
blocking_notifier_call_chain(&tracepoint_notify_list,
381380
MODULE_STATE_COMING, tp_mod);
@@ -393,7 +392,7 @@ static void tracepoint_module_going(struct module *mod)
393392

394393
mutex_lock(&tracepoint_module_list_mutex);
395394
list_for_each_entry(tp_mod, &tracepoint_module_list, list) {
396-
if (tp_mod->tracepoints_ptrs == mod->tracepoints_ptrs) {
395+
if (tp_mod->mod == mod) {
397396
blocking_notifier_call_chain(&tracepoint_notify_list,
398397
MODULE_STATE_GOING, tp_mod);
399398
list_del(&tp_mod->list);
@@ -447,9 +446,9 @@ static __init int init_tracepoints(void)
447446
int ret;
448447

449448
ret = register_module_notifier(&tracepoint_module_nb);
450-
if (ret) {
449+
if (ret)
451450
pr_warning("Failed to register tracepoint module enter notifier\n");
452-
}
451+
453452
return ret;
454453
}
455454
__initcall(init_tracepoints);

0 commit comments

Comments
 (0)