diff options
author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2008-11-14 17:47:38 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-16 03:01:28 -0500 |
commit | a419246ac7c2d9282dfd843103702895bb3f3fd7 (patch) | |
tree | 279750cd8eff8ec307d6c67b0ca4474b9b755b15 | |
parent | 021aeb057fc48af03fe5f37d3dda366c0d97aaf3 (diff) |
markers: use module notifier
Impact: cleanup
Use module notifiers instead of adding a hook in module.c.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/marker.c | 29 | ||||
-rw-r--r-- | kernel/module.c | 4 |
2 files changed, 29 insertions, 4 deletions
diff --git a/kernel/marker.c b/kernel/marker.c index 22cd7bae63e0..348e70cc355a 100644 --- a/kernel/marker.c +++ b/kernel/marker.c | |||
@@ -846,3 +846,32 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe, | |||
846 | return ERR_PTR(-ENOENT); | 846 | return ERR_PTR(-ENOENT); |
847 | } | 847 | } |
848 | EXPORT_SYMBOL_GPL(marker_get_private_data); | 848 | EXPORT_SYMBOL_GPL(marker_get_private_data); |
849 | |||
850 | int marker_module_notify(struct notifier_block *self, | ||
851 | unsigned long val, void *data) | ||
852 | { | ||
853 | struct module *mod = data; | ||
854 | |||
855 | switch (val) { | ||
856 | case MODULE_STATE_COMING: | ||
857 | marker_update_probe_range(mod->markers, | ||
858 | mod->markers + mod->num_markers); | ||
859 | break; | ||
860 | case MODULE_STATE_GOING: | ||
861 | marker_update_probe_range(mod->markers, | ||
862 | mod->markers + mod->num_markers); | ||
863 | break; | ||
864 | } | ||
865 | return 0; | ||
866 | } | ||
867 | |||
868 | struct notifier_block marker_module_nb = { | ||
869 | .notifier_call = marker_module_notify, | ||
870 | .priority = 0, | ||
871 | }; | ||
872 | |||
873 | static int init_markers(void) | ||
874 | { | ||
875 | return register_module_notifier(&marker_module_nb); | ||
876 | } | ||
877 | __initcall(init_markers); | ||
diff --git a/kernel/module.c b/kernel/module.c index 1f4cc00e0c20..72c6ca574211 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2184,10 +2184,6 @@ static noinline struct module *load_module(void __user *umod, | |||
2184 | struct mod_debug *debug; | 2184 | struct mod_debug *debug; |
2185 | unsigned int num_debug; | 2185 | unsigned int num_debug; |
2186 | 2186 | ||
2187 | #ifdef CONFIG_MARKERS | ||
2188 | marker_update_probe_range(mod->markers, | ||
2189 | mod->markers + mod->num_markers); | ||
2190 | #endif | ||
2191 | debug = section_objs(hdr, sechdrs, secstrings, "__verbose", | 2187 | debug = section_objs(hdr, sechdrs, secstrings, "__verbose", |
2192 | sizeof(*debug), &num_debug); | 2188 | sizeof(*debug), &num_debug); |
2193 | dynamic_printk_setup(debug, num_debug); | 2189 | dynamic_printk_setup(debug, num_debug); |