I'm new to kernel and driver programming, so i hope my question is not too simple.
I'm working with a madwifi driver, in order to add some functionalities of my own. In my code i added some variables and structures that need to be initialized before the actual code starts.
While working i have encountered the following question:
where is the best place to put the functions that in charge of initializing this variables/structures?
As far as i know, there is a special macro *module_init* which is being executed upon loading the module to the kernel, however, i could not find it in the madwifi driver code. What i have found instead is another famous macro, the *exit_module* though.
so my questions are:
- Is it recommended to add an init_module and do all my initializations there?
- Is it recommended to use the exit_module to free the allocated memory?
Thanks for the help!
Omer