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#ifndef MODULE
40
41#ifndef __ASSEMBLY__
42
43
44
45
46typedef int (*initcall_t)(void);
47typedef void (*exitcall_t)(void);
48
49extern initcall_t __initcall_start, __initcall_end;
50
51#define __initcall(fn) \
52 static initcall_t __initcall_##fn __init_call = fn
53#define __exitcall(fn) \
54 static exitcall_t __exitcall_##fn __exit_call = fn
55
56
57
58
59struct kernel_param {
60 const char *str;
61 int (*setup_func)(char *);
62};
63
64extern struct kernel_param __setup_start, __setup_end;
65
66#define __setup(str, fn) \
67 static char __setup_str_##fn[] __initdata = str; \
68 static struct kernel_param __setup_##fn __attribute__((unused)) __initsetup = { __setup_str_##fn, fn }
69
70#endif
71
72
73
74
75
76#define __init __attribute__ ((__section__ (".text.init")))
77#define __exit __attribute__ ((unused, __section__(".text.exit")))
78#define __initdata __attribute__ ((__section__ (".data.init")))
79#define __exitdata __attribute__ ((unused, __section__ (".data.exit")))
80#define __initsetup __attribute__ ((unused,__section__ (".setup.init")))
81#define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
82#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))
83
84
85#define __INIT .section ".text.init","ax"
86#define __FINIT .previous
87#define __INITDATA .section ".data.init","aw"
88
89#define module_init(x) __initcall(x);
90#define module_exit(x) __exitcall(x);
91
92#else
93
94#define __init
95#define __exit
96#define __initdata
97#define __exitdata
98#define __initcall(fn)
99
100#define __INIT
101#define __FINIT
102#define __INITDATA
103
104
105
106
107
108
109typedef int (*__init_module_func_t)(void);
110typedef void (*__cleanup_module_func_t)(void);
111#define module_init(x) \
112 int init_module(void) __attribute__((alias(#x))); \
113 extern inline __init_module_func_t __init_module_inline(void) \
114 { return x; }
115#define module_exit(x) \
116 void cleanup_module(void) __attribute__((alias(#x))); \
117 extern inline __cleanup_module_func_t __cleanup_module_inline(void) \
118 { return x; }
119
120#define __setup(str,func)
121
122#endif
123
124#ifdef CONFIG_HOTPLUG
125#define __devinit
126#define __devinitdata
127#define __devexit
128#define __devexitdata
129#else
130#define __devinit __init
131#define __devinitdata __initdata
132#define __devexit __exit
133#define __devexitdata __exitdata
134#endif
135
136#endif
137