当一个字符设备驱动不再需要的时候(比如模块卸载),就可以用 cdev_del()函数来释放 cdev占用的内存。 Name cdev_del — remove a cdev from the system Synopsis void fsfunc cdev_del( struct cdev * p); Arguments p : the cdev structure to be removed Description cdev_del removes p from the system,...
/*模块卸载函数*/voidsecond_exit(void){cdev_del(&second_devp->cdev);/*注销cdev*/kfree(second_devp);/*释放设备结构体内存*/unregister_chrdev_region(MKDEV(second_major,0),1);/*释放设备号*/} 开发者ID:nsood,项目名称:LinuxDriver_CodeList,代码行数:7,代码来源:second.c 示例6: frandom_init...