XenevaOS
Loading...
Searching...
No Matches
init.h
Go to the documentation of this file.
1#ifndef __LINUX_INIT_H__
2#define __LINUX_INIT_H__
3
4/*
5 * DCL <linux/init.h> -- initcall plumbing.
6 *
7 * mainline: fs_initcall(fn) stamps fn into .initcallN.init so do_initcalls()
8 * runs it after the core is up. Xeneva has no initcall sections in its PE
9 * image, so the macro instead stores fn in a named global pointer and
10 * DclRunInitcalls() -- DCL/linux_mm_shim.c, which names the initcalls it
11 * wants in the order it wants them -- calls them. Keeping the pointer
12 * (rather than an empty macro) also keeps the static __init function
13 * referenced, so it neither warns nor gets dropped.
14 *
15 * Runner naming: __dcl_initcall_<fn>.
16 */
17
18#ifndef __init
19#define __init
20#endif
21
22#ifndef __exit
23#define __exit
24#endif
25
26#ifndef __weak
27#define __weak __attribute__((weak))
28#endif
29
30#ifndef __maybe_unused
31#define __maybe_unused __attribute__((unused))
32#endif
33
34#define DCL_INITCALL(fn) \
35 int (*const __dcl_initcall_##fn)(void) __attribute__((used)) = fn
36
37#define fs_initcall(fn) DCL_INITCALL(fn)
38#define core_initcall(fn) DCL_INITCALL(fn)
39#define device_initcall(fn) DCL_INITCALL(fn)
40#define late_initcall(fn) DCL_INITCALL(fn)
41#define module_init(fn) DCL_INITCALL(fn)
42
43/*
44 * subsys_initcall -- one more level of mainline's 0..6 ordering, used by
45 * Vendored/drivers/dma-buf/dma-fence.c:131 to install its stub fence provider.
46 * DCL has no ordering between initcalls: DclRunInitcalls() (DCL/
47 * linux_mm_shim.c) names each one explicitly in the order it wants, so this
48 * lands in the same bucket as every other level here. What matters is that
49 * it exists at all -- without the macro the call site parses as an implicit
50 * int function call and the whole file fails from there.
51 *
52 * dma_fence_init_stub has to be added to that runner's list before it will
53 * actually run; see the ordering comment there.
54 */
55#define subsys_initcall(fn) DCL_INITCALL(fn)
56
57#endif /* __LINUX_INIT_H__ */