summaryrefslogtreecommitdiff
path: root/include/linux/init.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/init.h')
-rw-r--r--include/linux/init.h32
1 files changed, 29 insertions, 3 deletions
diff --git a/include/linux/init.h b/include/linux/init.h
index f0644ca302e8..0a9c2eba880e 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -50,8 +50,26 @@ typedef void (*exitcall_t)(void);
extern initcall_t __initcall_start, __initcall_end;
-#define __initcall(fn) \
- static initcall_t __initcall_##fn __init_call = fn
+/* initcalls are now grouped by functionality into separate
+ * subsections. Ordering inside the subsections is determined
+ * by link order.
+ * For backwards compatability, initcall() puts the call in
+ * the device init subsection.
+ */
+
+#define __define_initcall(level,fn) \
+ static initcall_t __initcall_##fn __attribute__ ((unused,__section__ (".initcall" level ".init"))) = fn
+
+#define early_arch_initcall(fn) __define_initcall("1",fn)
+#define mem_initcall(fn) __define_initcall("2",fn)
+#define subsys_initcall(fn) __define_initcall("3",fn)
+#define arch_initcall(fn) __define_initcall("4",fn)
+#define fs_initcall(fn) __define_initcall("5",fn)
+#define device_initcall(fn) __define_initcall("6",fn)
+#define late_initcall(fn) __define_initcall("7",fn)
+
+#define __initcall(fn) device_initcall(fn)
+
#define __exitcall(fn) \
static exitcall_t __exitcall_##fn __exit_call = fn
@@ -80,7 +98,7 @@ extern struct kernel_param __setup_start, __setup_end;
#define __initdata __attribute__ ((__section__ (".data.init")))
#define __exitdata __attribute__ ((unused, __section__ (".data.exit")))
#define __initsetup __attribute__ ((unused,__section__ (".setup.init")))
-#define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
+#define __init_call(level) __attribute__ ((unused,__section__ (".initcall" level ".init")))
#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))
/* For assembly routines */
@@ -141,6 +159,14 @@ typedef void (*__cleanup_module_func_t)(void);
#define __setup(str,func) /* nothing */
+#define early_arch_initcall(fn) module_init(fn)
+#define mem_initcall(fn) module_init(fn)
+#define subsys_initcall(fn) module_init(fn)
+#define arch_initcall(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)
+
#endif
#ifdef CONFIG_HOTPLUG