Re: [PATCH] Driver Core patches for 2.6.6

Greg KH
2004-05-14T23:28:45Z

ChangeSet 1.1587.5.23, 2004/05/11 13:32:24-07:00, greg@kroah.com

Module attributes: fix build error if CONFIG_MODULE_UNLOAD=n

Thanks to Andrew Morton for pointing this out to me.

kernel/module.c | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)

diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c Fri May 14 15:57:16 2004
+++ b/kernel/module.c Fri May 14 15:57:16 2004
@@ -379,6 +379,22 @@
}
#endif /* CONFIG_SMP */

+static int add_attribute(struct module *mod, struct kernel_param *kp)
+{
+ struct module_attribute *a;
+ int retval;
+
+ a = &mod->mkobj->attr[mod->mkobj->num_attributes];
+ a->attr.name = (char *)kp->name;
+ a->attr.owner = mod;
+ a->attr.mode = kp->perm;
+ a->param = kp;
+ retval = sysfs_create_file(&mod->mkobj->kobj, &a->attr);
+ if (!retval)
+ mod->mkobj->num_attributes++;
+ return retval;
+}
+
#ifdef CONFIG_MODULE_UNLOAD
/* Init the unload section of the module. */
static void module_unload_init(struct module *mod)
@@ -502,22 +518,6 @@
struct stopref sref = { mod, flags, forced };

return stop_machine_run(__try_stop_module, &sref, NR_CPUS);
-}
-
-static int add_attribute(struct module *mod, struct kernel_param *kp)
-{
- struct module_attribute *a;
- int retval;
-
- a = &mod->mkobj->attr[mod->mkobj->num_attributes];
- a->attr.name = (char *)kp->name;
- a->attr.owner = mod;
- a->attr.mode = kp->perm;
- a->param = kp;
- retval = sysfs_create_file(&mod->mkobj->kobj, &a->attr);
- if (!retval)
- mod->mkobj->num_attributes++;
- return retval;
}

unsigned int module_refcount(struct module *mod)