2008-08-06 02:22:07

by Robert P. J. Day

[permalink] [raw]
Subject: [PATCH] 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().

Signed-off-by: Robert P. J. Day <[email protected]>

---

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.

diff --git a/include/linux/init.h b/include/linux/init.h
index 11b84e1..38e4550 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -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
========================================================================