Equipment Drives must have two modules: init_module () / cleanup_module (), such as function name for initialization, another for uninstall
INIT_MODULE () The function of the main implementation: Register yourself to the kernel, tell the kernel This device already exists, it provides the interface to the kernel (File_Operation operation-driven core, directly control hardware operation), if this device is to use the kernel The resources provided are also applied at this time, such as interruption, memory, and nodes representing this device (virtual file). In addition, the device is initialized and sets the class of its register. For some embedded uclinux, it seems that no application node (virtual file) is used.
Cleanup_module () features and init_module () just opposite, it is to clear all traces of this device, which is restored to the phase without init_module (). At this stage, the device should log out to the kernel, release the resources it applied, disconnect all join.
The most important place in the device driver, is also the driver's soul is file_operation () ----- the operation of the device. Here, there is generally read, write, control, and operation of the device, etc. This should be introduced in detail in the subsequent article based on the specific equipment.