diff options
author | Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 2008-04-21 08:34:31 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-05-01 07:15:01 -0400 |
commit | df4b565e1fbc777bb6e274378a41fa8ff7485680 (patch) | |
tree | 8b64f22bb57419d57fdd4914645bafeaf9171733 | |
parent | b211104d111c99dbb97c636b57bd9db711455684 (diff) |
module: add MODULE_STATE_GOING notifier call
Provide module unload callback. Required by the gcov profiling
infrastructure to keep track of profiling data structures.
Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | kernel/module.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/module.c b/kernel/module.c index d2d093e74165..8674a390a2e8 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -745,12 +745,13 @@ sys_delete_module(const char __user *name_user, unsigned int flags) | |||
745 | if (!forced && module_refcount(mod) != 0) | 745 | if (!forced && module_refcount(mod) != 0) |
746 | wait_for_zero_refcount(mod); | 746 | wait_for_zero_refcount(mod); |
747 | 747 | ||
748 | mutex_unlock(&module_mutex); | ||
748 | /* Final destruction now noone is using it. */ | 749 | /* Final destruction now noone is using it. */ |
749 | if (mod->exit != NULL) { | 750 | if (mod->exit != NULL) |
750 | mutex_unlock(&module_mutex); | ||
751 | mod->exit(); | 751 | mod->exit(); |
752 | mutex_lock(&module_mutex); | 752 | blocking_notifier_call_chain(&module_notify_list, |
753 | } | 753 | MODULE_STATE_GOING, mod); |
754 | mutex_lock(&module_mutex); | ||
754 | /* Store the name of the last unloaded module for diagnostic purposes */ | 755 | /* Store the name of the last unloaded module for diagnostic purposes */ |
755 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); | 756 | strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); |
756 | free_module(mod); | 757 | free_module(mod); |
@@ -2191,6 +2192,8 @@ sys_init_module(void __user *umod, | |||
2191 | mod->state = MODULE_STATE_GOING; | 2192 | mod->state = MODULE_STATE_GOING; |
2192 | synchronize_sched(); | 2193 | synchronize_sched(); |
2193 | module_put(mod); | 2194 | module_put(mod); |
2195 | blocking_notifier_call_chain(&module_notify_list, | ||
2196 | MODULE_STATE_GOING, mod); | ||
2194 | mutex_lock(&module_mutex); | 2197 | mutex_lock(&module_mutex); |
2195 | free_module(mod); | 2198 | free_module(mod); |
2196 | mutex_unlock(&module_mutex); | 2199 | mutex_unlock(&module_mutex); |