On 01/03/2011 03:32 PM, Ben Hutchings wrote:
Try this. I've made it reasonably generic so you can easily add other hidden dependencies like tg3 -> broadcom. Ben.
I wrote a couple of macros for Karmic to solve a race problem that might be applicable here. I think there are several areas of the kernel that suffer from this type of indirect runtime registration issue. Unfortunately, this patch requires that you hack the macro values into the offending modules.
rtg -- Tim Gardner tim.gard...@canonical.com
>From 3a9048b7ebc1aefd539290238cfd4d2dfafbfa0a Mon Sep 17 00:00:00 2001 From: Tim Gardner <tim.gard...@canonical.com> Date: Tue, 6 Oct 2009 17:28:34 -0600 Subject: [PATCH] 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 <tim.gard...@canonical.com> --- include/linux/module.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 8b17fd8..9733e7f 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -712,4 +712,13 @@ static inline void 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 sym_link_##mod_name; EXPORT_SYMBOL(sym_link_##mod_name); +#define MODULE_IMPORT(mod_name) extern int sym_link_##mod_name; int func_sym_link_##mod_name(void) {sym_link_##mod_name=1;}; EXPORT_SYMBOL(func_sym_link_##mod_name); + + #endif /* _LINUX_MODULE_H */ -- 1.7.0.4