diff options
author | David S. Miller <davem@davemloft.net> | 2015-07-23 03:41:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-23 03:41:16 -0400 |
commit | c5e40ee287db61a79af1746954ee03ebbf1ff8a3 (patch) | |
tree | 007da00e75e9b84766ac4868421705300e1e2e14 /include/linux/module.h | |
parent | 052831879945be0d9fad2216b127147c565ec1b1 (diff) | |
parent | c5dfd654d0ec0a28fe81e7bd4d4fd984a9855e09 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
net/bridge/br_mdb.c
br_mdb.c conflict was a function call being removed to fix a bug in
'net' but whose signature was changed in 'net-next'.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r-- | include/linux/module.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index d67b1932cc59..3a19c79918e0 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/compiler.h> | 11 | #include <linux/compiler.h> |
12 | #include <linux/cache.h> | 12 | #include <linux/cache.h> |
13 | #include <linux/kmod.h> | 13 | #include <linux/kmod.h> |
14 | #include <linux/init.h> | ||
14 | #include <linux/elf.h> | 15 | #include <linux/elf.h> |
15 | #include <linux/stringify.h> | 16 | #include <linux/stringify.h> |
16 | #include <linux/kobject.h> | 17 | #include <linux/kobject.h> |
@@ -71,6 +72,89 @@ extern struct module_attribute module_uevent; | |||
71 | extern int init_module(void); | 72 | extern int init_module(void); |
72 | extern void cleanup_module(void); | 73 | extern void cleanup_module(void); |
73 | 74 | ||
75 | #ifndef MODULE | ||
76 | /** | ||
77 | * module_init() - driver initialization entry point | ||
78 | * @x: function to be run at kernel boot time or module insertion | ||
79 | * | ||
80 | * module_init() will either be called during do_initcalls() (if | ||
81 | * builtin) or at module insertion time (if a module). There can only | ||
82 | * be one per module. | ||
83 | */ | ||
84 | #define module_init(x) __initcall(x); | ||
85 | |||
86 | /** | ||
87 | * module_exit() - driver exit entry point | ||
88 | * @x: function to be run when driver is removed | ||
89 | * | ||
90 | * module_exit() will wrap the driver clean-up code | ||
91 | * with cleanup_module() when used with rmmod when | ||
92 | * the driver is a module. If the driver is statically | ||
93 | * compiled into the kernel, module_exit() has no effect. | ||
94 | * There can only be one per module. | ||
95 | */ | ||
96 | #define module_exit(x) __exitcall(x); | ||
97 | |||
98 | #else /* MODULE */ | ||
99 | |||
100 | /* | ||
101 | * In most cases loadable modules do not need custom | ||
102 | * initcall levels. There are still some valid cases where | ||
103 | * a driver may be needed early if built in, and does not | ||
104 | * matter when built as a loadable module. Like bus | ||
105 | * snooping debug drivers. | ||
106 | */ | ||
107 | #define early_initcall(fn) module_init(fn) | ||
108 | #define core_initcall(fn) module_init(fn) | ||
109 | #define core_initcall_sync(fn) module_init(fn) | ||
110 | #define postcore_initcall(fn) module_init(fn) | ||
111 | #define postcore_initcall_sync(fn) module_init(fn) | ||
112 | #define arch_initcall(fn) module_init(fn) | ||
113 | #define subsys_initcall(fn) module_init(fn) | ||
114 | #define subsys_initcall_sync(fn) module_init(fn) | ||
115 | #define fs_initcall(fn) module_init(fn) | ||
116 | #define fs_initcall_sync(fn) module_init(fn) | ||
117 | #define rootfs_initcall(fn) module_init(fn) | ||
118 | #define device_initcall(fn) module_init(fn) | ||
119 | #define device_initcall_sync(fn) module_init(fn) | ||
120 | #define late_initcall(fn) module_init(fn) | ||
121 | #define late_initcall_sync(fn) module_init(fn) | ||
122 | |||
123 | #define console_initcall(fn) module_init(fn) | ||
124 | #define security_initcall(fn) module_init(fn) | ||
125 | |||
126 | /* Each module must use one module_init(). */ | ||
127 | #define module_init(initfn) \ | ||
128 | static inline initcall_t __inittest(void) \ | ||
129 | { return initfn; } \ | ||
130 | int init_module(void) __attribute__((alias(#initfn))); | ||
131 | |||
132 | /* This is only required if you want to be unloadable. */ | ||
133 | #define module_exit(exitfn) \ | ||
134 | static inline exitcall_t __exittest(void) \ | ||
135 | { return exitfn; } \ | ||
136 | void cleanup_module(void) __attribute__((alias(#exitfn))); | ||
137 | |||
138 | #endif | ||
139 | |||
140 | /* This means "can be init if no module support, otherwise module load | ||
141 | may call it." */ | ||
142 | #ifdef CONFIG_MODULES | ||
143 | #define __init_or_module | ||
144 | #define __initdata_or_module | ||
145 | #define __initconst_or_module | ||
146 | #define __INIT_OR_MODULE .text | ||
147 | #define __INITDATA_OR_MODULE .data | ||
148 | #define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits | ||
149 | #else | ||
150 | #define __init_or_module __init | ||
151 | #define __initdata_or_module __initdata | ||
152 | #define __initconst_or_module __initconst | ||
153 | #define __INIT_OR_MODULE __INIT | ||
154 | #define __INITDATA_OR_MODULE __INITDATA | ||
155 | #define __INITRODATA_OR_MODULE __INITRODATA | ||
156 | #endif /*CONFIG_MODULES*/ | ||
157 | |||
74 | /* Archs provide a method of finding the correct exception table. */ | 158 | /* Archs provide a method of finding the correct exception table. */ |
75 | struct exception_table_entry; | 159 | struct exception_table_entry; |
76 | 160 | ||