Skip to contentSkip to conversation

Define a macro for subsys_initcall_sync() -> module_init().

PATCH New Robert P. J. Day 1 participant 1 message Aug 6, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Define a macro for subsys_initcall_sync() -> module_init().

Define the macro subsys_initcall_sync() to map to module_init() so that module code can stop horrifically abusing fs_initcall().

---

currently, a number of source files under drivers/ will use a call to fs_initcall() instead of module_init() to get precise control over when that code runs if it is compiled into the kernel -- that is, to *guarantee* that that code runs after all subsys initcalls but before any device initcalls.

it's not clear that that level of fine-grained control is truly necessary in *all* of those cases but, if it is, then it makes more sense to use subsys_initcall_sync(), since it semantically makes more sense in showing when that happens. using fs_initcall() is just an ugly hack.

this seems like it wouldn't introduce any problems since there are no invocations of subsys_initcall_sync() anywhere in the source tree at the moment.

include/linux/init.h +1 -0
index 11b84e1..38e4550 100644
@@ -276,6 +276,7 @@ void __init parse_early_param(void);
 #define postcore_initcall(fn)		module_init(fn)
 #define arch_initcall(fn)		module_init(fn)
 #define subsys_initcall(fn)		module_init(fn)
+#define subsys_initcall_sync(fn)	module_init(fn)
 #define fs_initcall(fn)			module_init(fn)
 #define device_initcall(fn)		module_init(fn)
 #define late_initcall(fn)		module_init(fn)

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.

http://crashcourse.ca Waterloo, Ontario, CANADA
========================================================================