mirror of
https://github.com/0xAX/linux-insides.git
synced 2024-12-22 06:38:07 +00:00
concepts/initcalls: add module_init macro information
While reading about initcalls around the web and kernel source code I found that the information of what happens to __init functions not explicitly set to any initcall list pretty useful. With this patch such information is added. Signed-off-by: Bruno Meneguele <bmeneguele@gmail.com>
This commit is contained in:
parent
cbc004adde
commit
cdbc603fbd
@ -381,6 +381,20 @@ Besides the `rootfs_initcall` level, there are additional `console_initcall`, `s
|
||||
|
||||
The main goal of these additional levels is to wait for completion of all modules related initialization routines for a certain level.
|
||||
|
||||
Another point worthy of mention is the `module_init(x)` macro, defined at [include/linux/module.h](https://github.com/torvalds/linux/blob/16f73eb02d7e1765ccab3d2018e0bd98eb93d973/include/linux/module.h) as:
|
||||
|
||||
```C
|
||||
#define module_init(x) __initcall(x);
|
||||
```
|
||||
|
||||
If we follow and check what's the definition of `__initcall(x)` at [include/linux/init.h](https://github.com/torvalds/linux/blob/16f73eb02d7e1765ccab3d2018e0bd98eb93d973/include/linux/init.h) we can see that it's being set as an `device_initcall`:
|
||||
|
||||
```C
|
||||
#define __initcall(fn) device_initcall(fn)
|
||||
```
|
||||
|
||||
With that we can conclude that when a function set as `__init` of certain module isn't explicitly added to a specific initcall category, but using `module_init()` macro, it is added to device initcall list by default.
|
||||
|
||||
That's all.
|
||||
|
||||
Conclusion
|
||||
|
Loading…
Reference in New Issue
Block a user