Kumar Vivek
Kumar Vivek

Reputation: 41

What is the advantage of [inittest] in Kernel

 /* Each module must use one module_init(). */
#define module_init(initfn)                 \
    static inline initcall_t __inittest(void)       \
    { return initfn; }                  \
    int init_module(void) __attribute__((alias(#initfn)));

Upvotes: 3

Views: 403

Answers (1)

Dummy00001
Dummy00001

Reputation: 17420

The sole purpose of the generated __inittest() function it to check during compile time, that the function passed to module_init() macro is compatible with the initcall_t type.

All module initialization functions must conform to the type, since (as can be seen from the init_module() definition) they are not called directly, but rather are called via special aliased name init_module().

Upvotes: 4

Related Questions