Skip to contentSkip to conversation

module device table restoration

PATCH In review Rusty Russell 2 participants 2 messages Nov 20, 2002 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module device table restoration

Patch from Adam Richter. I have a nicer solution based on aliases, but it requires coordination with USB, PCI and PCMCIA maintainers, which is taking time.

This restores the old code in the meantime: one week without this is too long or people who need it. 8(

Please apply unless Adam has objections,
Rusty.

include/linux/module.h +15 -3
@@ -26,8 +26,6 @@
 #define MODULE_AUTHOR(name)
 #define MODULE_DESCRIPTION(desc)
 #define MODULE_SUPPORTED_DEVICE(name)
-#define MODULE_GENERIC_TABLE(gtype,name)
-#define MODULE_DEVICE_TABLE(type,name)
 #define MODULE_PARM_DESC(var,desc)
 #define print_symbol(format, addr)
 #define print_modules()
@@ -40,14 +38,28 @@
 };
 
 #ifdef MODULE
+
+#define MODULE_GENERIC_TABLE(gtype,name)	\
+static const unsigned long __module_##gtype##_size \
+  __attribute__ ((unused)) = sizeof(struct gtype##_id); \
+static const struct gtype##_id * __module_##gtype##_table \
+  __attribute__ ((unused)) = name
+
 /* This is magically filled in by the linker, but THIS_MODULE must be
    a constant so it works in initializers. */
 extern struct module __this_module;
 #define THIS_MODULE (&__this_module)
-#else
+
+#else  /* !MODULE */
+
+#define MODULE_GENERIC_TABLE(gtype,name)
 #define THIS_MODULE ((struct module *)0)
+
 #endif
 
+#define MODULE_DEVICE_TABLE(type,name)		\
+  MODULE_GENERIC_TABLE(type##_device,name)
+
 #ifdef CONFIG_MODULES
 /* Get/put a kernel symbol (calls must be symmetric) */
 void *__symbol_get(const char *symbol);
#1 lore raw
Quoted 3 lines · Rusty Russell

Patch from Adam Richter. I have a nicer solution based on aliases, but it requires coordination with USB, PCI and PCMCIA maintainers, which is taking time.

Oops, was I supposed to be doing something? :)

I liked your patch that did the aliases, but had a few questions about it. I guess I need to go dig up that email, sorry.

greg k-h