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
Showing the changes to kernel (1 of 2 files). Show all
Unified · Split
| @@ -374,8 +374,7 @@ static int tracepoint_module_coming(struct module *mod) · 373 unmodified lines | ||
| 374 | 374 | ret = -ENOMEM; |
| 375 | 375 | goto end; |
| 376 | 376 | } |
| 377 | − tp_mod->num_tracepoints = mod->num_tracepoints; | |
| 378 | − tp_mod->tracepoints_ptrs = mod->tracepoints_ptrs; | |
| 377 | + tp_mod->mod = mod; | |
| 379 | 378 | list_add_tail(&tp_mod->list, &tracepoint_module_list); |
| 380 | 379 | blocking_notifier_call_chain(&tracepoint_notify_list, |
| 381 | 380 | MODULE_STATE_COMING, tp_mod); |
| @@ -393,7 +392,7 @@ static void tracepoint_module_going(struct module *mod) · 11 unmodified lines | ||
| 393 | 392 | |
| 394 | 393 | mutex_lock(&tracepoint_module_list_mutex); |
| 395 | 394 | 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) { | |
| 397 | 396 | blocking_notifier_call_chain(&tracepoint_notify_list, |
| 398 | 397 | MODULE_STATE_GOING, tp_mod); |
| 399 | 398 | list_del(&tp_mod->list); |
| @@ -447,9 +446,9 @@ static __init int init_tracepoints(void) · 47 unmodified lines | ||
| 447 | 446 | int ret; |
| 448 | 447 | |
| 449 | 448 | ret = register_module_notifier(&tracepoint_module_nb); |
| 450 | − if (ret) { | |
| 449 | + if (ret) | |
| 451 | 450 | pr_warning("Failed to register tracepoint module enter notifier\n"); |
| 452 | − } | |
| 451 | + | |
| 453 | 452 | return ret; |
| 454 | 453 | } |
| 455 | 454 | __initcall(init_tracepoints); |