Modules do not have a main function.
But at least 2 functions are expected. Originally, these had to be named init_module and cleanup_module:
int init_module(void); void cleanup_module(void);
The init_module function executes when the module is "inserted" into the kernel and cleanup_module, when it is removed.
Note: Some kernel modules are not removed while the system is running.