Article Title: linux drivers cannot be uninstalled after being loaded. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Sometimes this occurs when writing a driver. After a module is loaded, it cannot be detached or uninstalled. After cat/proc/devices, it is found that the device still occupies the device number, in this case, re-loading the driver module will certainly not succeed. You must restart it to solve the problem. I recently read the book carefully and found that I did not write two function calls in the driver's unmount function, so that the devices applied for or added during module loading were not released or deleted.
Solution:
Step 1: create a directory consistent with the current kernel version in the/lib/modules/directory. For example, if uname-r returns 2.6.31.6, then mkdir-p/lib/modules/2.6.31.6 or "rmmod" appears.: chdir (2.6.31.6): No such file or directory "similar error, and the module is not uninstalled;
Step 2: unmount the cdev_del (struct cdev *) function in function _ exit in the driver module. After the function is called, The unregister_chrdev_region (dev_t devno, unsigned count) is called) the function is released in the driver load function _ init through register_chrdev_region, alloc_chrdev_region, registered master device number. (The cdev_del function and the unregister_chrdev_region function are indispensable );
After the above two steps, the rmmod Module name will not be uninstalled, and cat/proc/devices will not have information about the modules that have been uninstalled, in this way, the module will not be loaded again!
I have encountered this problem. It depends on the module name of a person. It is the same as the device name. If it is the same, rmmod * is used directly *. if ko is not the same, you have to use the rmmod device name. ko, mainly in the module name, and device name.
For the mini2440 Development Board, you need to create/lib/modules/2.6.29.4-Friendlyarm
But you have to check your kernel version, so 2.6.29.4 is not the same as yours. You need
# Uname-r
Check your kernel version and replace it.