|
Revision 463, 1.8 kB
(checked in by mwhitworth, 5 months ago)
|
|
Define CoreInit, FsInit, ..., to correspond to ModuleInit if a module.
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | #ifndef INIT_H |
|---|
| 20 | #define INIT_H |
|---|
| 21 | |
|---|
| 22 | #include <module.h> |
|---|
| 23 | #include <typedefs.h> |
|---|
| 24 | |
|---|
| 25 | #ifndef MODULE |
|---|
| 26 | |
|---|
| 27 | #define __init __attribute__ ((section (".init.text"))) |
|---|
| 28 | #define __initdata __attribute__ ((section ("init.data"))) |
|---|
| 29 | #define __exit __attribute__ ((section (".exit.text")) |
|---|
| 30 | |
|---|
| 31 | typedef int (*InitCall)(); |
|---|
| 32 | typedef void (*ExitCall)(); |
|---|
| 33 | |
|---|
| 34 | #define ATTR_USED __attribute__((used)) |
|---|
| 35 | |
|---|
| 36 | #define DeclareInitCall(level,func) \ |
|---|
| 37 | static InitCall __initcall_##func ATTR_USED \ |
|---|
| 38 | __attribute__((__section__(".initcall" level ".init")))=func |
|---|
| 39 | |
|---|
| 40 | #define CoreInit(func) DeclareInitCall("1",func) |
|---|
| 41 | #define FsInit(func) DeclareInitCall("2",func) |
|---|
| 42 | #define NetInit(func) DeclareInitCall("2",func) |
|---|
| 43 | #define DeviceInit(func) DeclareInitCall("3",func) |
|---|
| 44 | #define SubSysInit(func) DeclareInitCall("4", func) |
|---|
| 45 | |
|---|
| 46 | #else |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | #define CoreInit(func) ModuleInit(func) |
|---|
| 50 | #define FsInit(func) ModuleInit(func) |
|---|
| 51 | #define NetInit(func) ModuleInit(func) |
|---|
| 52 | #define DeviceInit(func) ModuleInit(func) |
|---|
| 53 | #define SubSysInit(func) ModuleInit(func) |
|---|
| 54 | |
|---|
| 55 | #endif |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | #endif |
|---|