1#ifndef _LINUX_INIT_H
2#define _LINUX_INIT_H
3
4#include <linux/config.h>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41#ifndef MODULE
42
43#ifndef __ASSEMBLY__
44
45
46
47
48typedef int (*initcall_t)(void);
49typedef void (*exitcall_t)(void);
50
51extern initcall_t __initcall_start, __initcall_end;
52
53#define __initcall(fn) \
54 static initcall_t __initcall_##fn __init_call = fn
55#define __exitcall(fn) \
56 static exitcall_t __exitcall_##fn __exit_call = fn
57
58
59
60
61struct kernel_param {
62 const char *str;
63 int (*setup_func)(char *);
64};
65
66extern struct kernel_param __setup_start, __setup_end;
67
68#define __setup(str, fn) \
69 static char __setup_str_##fn[] __initdata = str; \
70 static struct kernel_param __setup_##fn __attribute__((unused)) __initsetup = { __setup_str_##fn, fn }
71
72#endif
73
74
75
76
77
78#define __init __attribute__ ((__section__ (".text.init")))
79#define __exit __attribute__ ((unused, __section__(".text.exit")))
80#define __initdata __attribute__ ((__section__ (".data.init")))
81#define __exitdata __attribute__ ((unused, __section__ (".data.exit")))
82#define __initsetup __attribute__ ((unused,__section__ (".setup.init")))
83#define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
84#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))
85
86
87#define __INIT .section ".text.init","ax"
88#define __FINIT .previous
89#define __INITDATA .section ".data.init","aw"
90
91
92
93
94
95
96
97
98
99
100
101#define module_init(x) __initcall(x);
102
103
104
105
106
107
108
109
110
111
112#define module_exit(x) __exitcall(x);
113
114#else
115
116#define __init
117#define __exit
118#define __initdata
119#define __exitdata
120#define __initcall(fn)
121
122#define __INIT
123#define __FINIT
124#define __INITDATA
125
126
127
128
129
130
131typedef int (*__init_module_func_t)(void);
132typedef void (*__cleanup_module_func_t)(void);
133#define module_init(x) \
134 int init_module(void) __attribute__((alias(#x))); \
135 static inline __init_module_func_t __init_module_inline(void) \
136 { return x; }
137#define module_exit(x) \
138 void cleanup_module(void) __attribute__((alias(#x))); \
139 static inline __cleanup_module_func_t __cleanup_module_inline(void) \
140 { return x; }
141
142#define __setup(str,func)
143
144#endif
145
146#ifdef CONFIG_HOTPLUG
147#define __devinit
148#define __devinitdata
149#define __devexit
150#define __devexitdata
151#else
152#define __devinit __init
153#define __devinitdata __initdata
154#define __devexit __exit
155#define __devexitdata __exitdata
156#endif
157
158
159
160
161
162
163
164#if defined(MODULE) || defined(CONFIG_HOTPLUG)
165#define __devexit_p(x) x
166#else
167#define __devexit_p(x) NULL
168#endif
169
170#endif
171