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 /kernel/marker.c | |
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>
Diffstat (limited to 'kernel/marker.c')
-rw-r--r-- | kernel/marker.c | 29 |
1 files changed, 29 insertions, 0 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); | ||