From 027d03bb1245698cf5f7f0bba7239c742504c070 Mon Sep 17 00:00:00 2001 From: Tim Gardner Date: Tue, 6 Oct 2009 17:28:34 -0600 Subject: [PATCH 1/1] UBUNTU: SAUCE: Created MODULE_EXPORT/MODULE_IMPORT macros BugLink: http://bugs.launchpad.net/bugs/430694 Create a macro pair that can be used to symbolicly link two modules if they are not already directly linked. This relationship uses the facilities of depmod and modprobe to get soft dependencies loaded in the correct order. Examples of soft dependencies are: 1) i915 and intel_agp (agp _must_ be loaded before i915) 2) any net driver that uses phylib modules. Signed-off-by: Tim Gardner --- include/linux/module.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 098bdb7..49f53f2 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -720,4 +720,12 @@ static inline int module_bug_finalize(const Elf_Ehdr *hdr, static inline void module_bug_cleanup(struct module *mod) {} #endif /* CONFIG_GENERIC_BUG */ +/* + * Establish a symbolic link between 2 modules so that depmod + * and modprobe do the heavy lifting of loading the modules in the + * correct dependency order. + */ +#define MODULE_EXPORT(mod_name) int mod_name; EXPORT_SYMBOL(mod_name); +#define MODULE_IMPORT(mod_name) extern int mod_name; + #endif /* _LINUX_MODULE_H */ -- 1.7.0.4