From: Matthew Dobson <colpatch@us.ibm.com>

-rc5-mm2 breaks for me with the attached config.  The attached patch fixes
it for me.  It's because I have CONFIG_MODULES but not CONFIG_MODULE_UNLOAD.

kernel/module.c: In function `module_add_modinfo_attrs':
kernel/module.c:1078: error: `modinfo_attrs' undeclared (first use in this
function)
kernel/module.c:1078: error: (Each undeclared identifier is reported only once
kernel/module.c:1078: error: for each function it appears in.)
kernel/module.c: In function `module_remove_modinfo_attrs':
kernel/module.c:1091: error: `modinfo_attrs' undeclared (first use in this
function)
kernel/module.c: In function `setup_modinfo':
kernel/module.c:1387: error: `modinfo_attrs' undeclared (first use in this
function)
  CC      kernel/kallsyms.o
  CC      kernel/irq/handle.o
  CC      kernel/irq/manage.o
make[1]: *** [kernel/module.o] Error 1
make[1]: *** Waiting for unfinished jobs....

Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

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

diff -puN kernel/module.c~modules-add-version-and-srcversion-to-sysfs-fix kernel/module.c
--- 25/kernel/module.c~modules-add-version-and-srcversion-to-sysfs-fix	2005-06-01 18:48:21.000000000 -0700
+++ 25-akpm/kernel/module.c	2005-06-01 18:48:21.000000000 -0700
@@ -370,6 +370,43 @@ static inline void percpu_modcopy(void *
 }
 #endif /* CONFIG_SMP */
 
+#define MODINFO_ATTR(field)	\
+static void setup_modinfo_##field(struct module *mod, const char *s)  \
+{                                                                     \
+	mod->field = kstrdup(s, GFP_KERNEL);                          \
+}                                                                     \
+static ssize_t show_modinfo_##field(struct module_attribute *mattr,   \
+	                struct module *mod, char *buffer)             \
+{                                                                     \
+	return sprintf(buffer, "%s\n", mod->field);                   \
+}                                                                     \
+static int modinfo_##field##_exists(struct module *mod)               \
+{                                                                     \
+	return mod->field != NULL;                                    \
+}                                                                     \
+static void free_modinfo_##field(struct module *mod)                  \
+{                                                                     \
+        kfree(mod->field);                                            \
+        mod->field = NULL;                                            \
+}                                                                     \
+static struct module_attribute modinfo_##field = {                    \
+	.attr = { .name = __stringify(field), .mode = 0444,           \
+		  .owner = THIS_MODULE },                             \
+	.show = show_modinfo_##field,                                 \
+	.setup = setup_modinfo_##field,                               \
+	.test = modinfo_##field##_exists,                             \
+	.free = free_modinfo_##field,                                 \
+};
+
+MODINFO_ATTR(version);
+MODINFO_ATTR(srcversion);
+
+static struct module_attribute *modinfo_attrs[] = {
+	&modinfo_version,
+	&modinfo_srcversion,
+	NULL,
+};
+
 #ifdef CONFIG_MODULE_UNLOAD
 /* Init the unload section of the module. */
 static void module_unload_init(struct module *mod)
@@ -664,43 +701,6 @@ static struct module_attribute refcnt = 
 	.show = show_refcnt,
 };
 
-#define MODINFO_ATTR(field)	\
-static void setup_modinfo_##field(struct module *mod, const char *s)  \
-{                                                                     \
-	mod->field = kstrdup(s, GFP_KERNEL);                          \
-}                                                                     \
-static ssize_t show_modinfo_##field(struct module_attribute *mattr,   \
-	                struct module *mod, char *buffer)             \
-{                                                                     \
-	return sprintf(buffer, "%s\n", mod->field);                   \
-}                                                                     \
-static int modinfo_##field##_exists(struct module *mod)               \
-{                                                                     \
-	return mod->field != NULL;                                    \
-}                                                                     \
-static void free_modinfo_##field(struct module *mod)                  \
-{                                                                     \
-        kfree(mod->field);                                            \
-        mod->field = NULL;                                            \
-}                                                                     \
-static struct module_attribute modinfo_##field = {                    \
-	.attr = { .name = __stringify(field), .mode = 0444,           \
-		  .owner = THIS_MODULE },                             \
-	.show = show_modinfo_##field,                                 \
-	.setup = setup_modinfo_##field,                               \
-	.test = modinfo_##field##_exists,                             \
-	.free = free_modinfo_##field,                                 \
-};
-
-MODINFO_ATTR(version);
-MODINFO_ATTR(srcversion);
-
-static struct module_attribute *modinfo_attrs[] = {
-	&modinfo_version,
-	&modinfo_srcversion,
-	NULL,
-};
-
 #else /* !CONFIG_MODULE_UNLOAD */
 static void print_unload_info(struct seq_file *m, struct module *mod)
 {
_