summaryrefslogtreecommitdiff
path: root/kernel/marker.c
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2008-11-14 17:47:38 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-16 09:01:28 +0100
commita419246ac7c2d9282dfd843103702895bb3f3fd7 (patch)
tree279750cd8eff8ec307d6c67b0ca4474b9b755b15 /kernel/marker.c
parent021aeb057fc48af03fe5f37d3dda366c0d97aaf3 (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.c29
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,
return ERR_PTR(-ENOENT);
}
EXPORT_SYMBOL_GPL(marker_get_private_data);
+
+int marker_module_notify(struct notifier_block *self,
+ unsigned long val, void *data)
+{
+ struct module *mod = data;
+
+ switch (val) {
+ case MODULE_STATE_COMING:
+ marker_update_probe_range(mod->markers,
+ mod->markers + mod->num_markers);
+ break;
+ case MODULE_STATE_GOING:
+ marker_update_probe_range(mod->markers,
+ mod->markers + mod->num_markers);
+ break;
+ }
+ return 0;
+}
+
+struct notifier_block marker_module_nb = {
+ .notifier_call = marker_module_notify,
+ .priority = 0,
+};
+
+static int init_markers(void)
+{
+ return register_module_notifier(&marker_module_nb);
+}
+__initcall(init_markers);