北城已荒凉 2018-10-30 07:05 采纳率: 0%
浏览 396

删除设备创建()、类创建()和 alloc chrdev 区域()创建的文件

After creating a character device driver using alloc_chrdev_region(), cdev_init(), cdev_add(), class_create() and device_create() I am unable to successfully clean all the entries made by the functions above in the module_exit(). When I use rmmod it just says "Killed". When I check the /proc/devices/, /sys/class/ and /dev/ directories my created files are still present. How can I make a clean exit of my module? The code I am using for exit:

static void char_exit(void)
{
    printk(KERN_ALERT "leaving the kernel.");
    cdev_del(my_chardev);

    device_destroy(myclass,first);

    class_destroy(myclass);

    unregister_chrdev_region(first,1);
}

For some reason it's not working.

转载于:https://stackoverflow.com/questions/53058991/removing-files-created-by-device-create-class-create-and-alloc-chrdev-regio

  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2018-10-31 14:33
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型