Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=af49d9248fca6f26cbdb01918334f71d9040df80
Commit:     af49d9248fca6f26cbdb01918334f71d9040df80
Parent:     d9c9bef1345e5d9258febce2a37e4d40319fa728
Author:     Rusty Russell <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 23:26:27 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Oct 17 08:42:49 2007 -0700

    Remove "unsafe" from module struct
    
    Adrian Bunk points out that "unsafe" was used to mark modules touched by
    the deprecated MOD_INC_USE_COUNT interface, which has long gone.  It's time
    to remove the member from the module structure, as well.
    
    If you want a module which can't unload, don't register an exit function.
    
    (Vlad Yasevich says SCTP is now safe to unload, so just remove the
    __unsafe there).
    
    Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>
    Acked-by: Shannon Nelson <[EMAIL PROTECTED]>
    Acked-by: Dan Williams <[EMAIL PROTECTED]>
    Acked-by: Vlad Yasevich <[EMAIL PROTECTED]>
    Cc: Sridhar Samudrala <[EMAIL PROTECTED]>
    Cc: Adrian Bunk <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/dma/iop-adma.c |    9 ++++-----
 include/linux/module.h |   15 ---------------
 kernel/module.c        |   21 +++++----------------
 net/sctp/protocol.c    |    1 -
 4 files changed, 9 insertions(+), 37 deletions(-)

diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 5a1d426..e5c62b7 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -1446,21 +1446,20 @@ static struct platform_driver iop_adma_driver = {
 
 static int __init iop_adma_init (void)
 {
-       /* it's currently unsafe to unload this module */
-       /* if forced, worst case is that rmmod hangs */
-       __unsafe(THIS_MODULE);
-
        return platform_driver_register(&iop_adma_driver);
 }
 
+/* it's currently unsafe to unload this module */
+#if 0
 static void __exit iop_adma_exit (void)
 {
        platform_driver_unregister(&iop_adma_driver);
        return;
 }
+module_exit(iop_adma_exit);
+#endif
 
 module_init(iop_adma_init);
-module_exit(iop_adma_exit);
 
 MODULE_AUTHOR("Intel Corporation");
 MODULE_DESCRIPTION("IOP ADMA Engine Driver");
diff --git a/include/linux/module.h b/include/linux/module.h
index b6a646c..5523e10 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -312,9 +312,6 @@ struct module
        /* Arch-specific module values */
        struct mod_arch_specific arch;
 
-       /* Am I unsafe to unload? */
-       int unsafe;
-
        unsigned int taints;    /* same bits as kernel:tainted */
 
 #ifdef CONFIG_GENERIC_BUG
@@ -441,16 +438,6 @@ static inline void __module_get(struct module *module)
        __mod ? __mod->name : "kernel";         \
 })
 
-#define __unsafe(mod)                                                       \
-do {                                                                        \
-       if (mod && !(mod)->unsafe) {                                         \
-               printk(KERN_WARNING                                          \
-                      "Module %s cannot be unloaded due to unsafe usage in" \
-                      " %s:%u\n", (mod)->name, __FILE__, __LINE__);         \
-               (mod)->unsafe = 1;                                           \
-       }                                                                    \
-} while(0)
-
 /* For kallsyms to ask for address resolution.  NULL means not found. */
 const char *module_address_lookup(unsigned long addr,
                                  unsigned long *symbolsize,
@@ -518,8 +505,6 @@ static inline void module_put(struct module *module)
 
 #define module_name(mod) "kernel"
 
-#define __unsafe(mod)
-
 /* For kallsyms to ask for address resolution.  NULL means not found. */
 static inline const char *module_address_lookup(unsigned long addr,
                                                unsigned long *symbolsize,
diff --git a/kernel/module.c b/kernel/module.c
index db0ead0..35246a6 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -692,8 +692,7 @@ sys_delete_module(const char __user *name_user, unsigned 
int flags)
        }
 
        /* If it has an init func, it must have an exit func to unload */
-       if ((mod->init != NULL && mod->exit == NULL)
-           || mod->unsafe) {
+       if (mod->init && !mod->exit) {
                forced = try_force_unload(flags);
                if (!forced) {
                        /* This module can't be removed */
@@ -741,11 +740,6 @@ static void print_unload_info(struct seq_file *m, struct 
module *mod)
                seq_printf(m, "%s,", use->module_which_uses->name);
        }
 
-       if (mod->unsafe) {
-               printed_something = 1;
-               seq_printf(m, "[unsafe],");
-       }
-
        if (mod->init != NULL && mod->exit == NULL) {
                printed_something = 1;
                seq_printf(m, "[permanent],");
@@ -2011,15 +2005,10 @@ sys_init_module(void __user *umod,
                    buggy refcounters. */
                mod->state = MODULE_STATE_GOING;
                synchronize_sched();
-               if (mod->unsafe)
-                       printk(KERN_ERR "%s: module is now stuck!\n",
-                              mod->name);
-               else {
-                       module_put(mod);
-                       mutex_lock(&module_mutex);
-                       free_module(mod);
-                       mutex_unlock(&module_mutex);
-               }
+               module_put(mod);
+               mutex_lock(&module_mutex);
+               free_module(mod);
+               mutex_unlock(&module_mutex);
                return ret;
        }
 
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 81b26c5..f5cd96f 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1228,7 +1228,6 @@ SCTP_STATIC __init int sctp_init(void)
        if (status)
                goto err_v6_add_protocol;
 
-       __unsafe(THIS_MODULE);
        status = 0;
 out:
        return status;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to