Reputation: 41
/* 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
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