From: Thierry Vignaud <tvignaud@mandriva.com>

fix compiling w/o CONFIG_MODULE_UNLOAD

my config being:
(...)
CONFIG_MODULES=y
# CONFIG_MODULE_UNLOAD is not set
CONFIG_OBSOLETE_MODPARM=y
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_KMOD=y
(...)

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 kernel/module.c |   10 ++++++++++
 1 files changed, 10 insertions(+)

diff -puN kernel/module.c~modules-add-version-and-srcversion-to-sysfs-fix-2 kernel/module.c
--- 25/kernel/module.c~modules-add-version-and-srcversion-to-sysfs-fix-2	2005-06-05 23:28:13.000000000 -0700
+++ 25-akpm/kernel/module.c	2005-06-05 23:28:13.000000000 -0700
@@ -1069,6 +1069,7 @@ static void module_remove_refcnt_attr(st
 }
 #endif
 
+#ifdef CONFIG_MODULE_UNLOAD
 static int module_add_modinfo_attrs(struct module *mod)
 {
 	struct module_attribute *attr;
@@ -1093,6 +1094,7 @@ static void module_remove_modinfo_attrs(
 		attr->free(mod);
 	}
 }
+#endif
 
 static int mod_sysfs_setup(struct module *mod,
 			   struct kernel_param *kparam,
@@ -1118,9 +1120,11 @@ static int mod_sysfs_setup(struct module
 	if (err)
 		goto out_unreg;
 
+#ifdef CONFIG_MODULE_UNLOAD
 	err = module_add_modinfo_attrs(mod);
 	if (err)
 		goto out_unreg;
+#endif
 
 	return 0;
 
@@ -1132,7 +1136,9 @@ out:
 
 static void mod_kobject_remove(struct module *mod)
 {
+#ifdef CONFIG_MODULE_UNLOAD
 	module_remove_modinfo_attrs(mod);
+#endif
 	module_remove_refcnt_attr(mod);
 	module_param_sysfs_remove(mod);
 
@@ -1378,6 +1384,7 @@ static char *get_modinfo(Elf_Shdr *sechd
 	return NULL;
 }
 
+#ifdef CONFIG_MODULE_UNLOAD
 static void setup_modinfo(struct module *mod, Elf_Shdr *sechdrs,
 			  unsigned int infoindex)
 {
@@ -1392,6 +1399,7 @@ static void setup_modinfo(struct module 
 						attr->attr.name));
 	}
 }
+#endif
 
 #ifdef CONFIG_KALLSYMS
 int is_exported(const char *name, const struct module *mod)
@@ -1697,8 +1705,10 @@ static struct module *load_module(void _
 	/* Set up license info based on the info section */
 	set_license(mod, get_modinfo(sechdrs, infoindex, "license"));
 
+#ifdef CONFIG_MODULE_UNLOAD
 	/* Set up MODINFO_ATTR fields */
 	setup_modinfo(mod, sechdrs, infoindex);
+#endif
 
 	/* Fix up syms, so that st_value is a pointer to location. */
 	err = simplify_symbols(sechdrs, symindex, strtab, versindex, pcpuindex,
_