新手入门
- 积分
- 11
- 金钱
- 11
- 注册时间
- 2021-11-7
- 在线时间
- 2 小时
|
提示如下:
/lib/modules/4.1.15 # depmod
/lib/modules/4.1.15 # modprobe newchrled.ko
newchrled major=249, minor=0
newchrled major=248, minor=0
------------[ cut here ]------------
WARNING: CPU: 0 PID: 76 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x54/0x74()
sysfs: cannot create duplicate filename '/class/newchrled'
Modules linked in: newchrled(O+)
CPU: 0 PID: 76 Comm: modprobe Tainted: G O 4.1.15 #4
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015ed4>] (unwind_backtrace) from [<80012794>] (show_stack+0x10/0x14)
[<80012794>] (show_stack) from [<8068cc84>] (dump_stack+0x80/0xc8)
[<8068cc84>] (dump_stack) from [<8003824c>] (warn_slowpath_common+0x74/0xb0)
[<8003824c>] (warn_slowpath_common) from [<800382b8>] (warn_slowpath_fmt+0x30/0x40)
[<800382b8>] (warn_slowpath_fmt) from [<8014b774>] (sysfs_warn_dup+0x54/0x74)
[<8014b774>] (sysfs_warn_dup) from [<8014b860>] (sysfs_create_dir_ns+0x84/0x9c)
[<8014b860>] (sysfs_create_dir_ns) from [<8029e380>] (kobject_add_internal+0xa0/0x2d8)
[<8029e380>] (kobject_add_internal) from [<8029e670>] (kset_register+0x50/0x7c)
[<8029e670>] (kset_register) from [<8034e604>] (__class_register+0xa8/0x1bc)
[<8034e604>] (__class_register) from [<8034e758>] (__class_create+0x40/0x78)
[<8034e758>] (__class_create) from [<7f0061e0>] (newchrled_init+0x1e0/0x244 [newchrled])
[<7f0061e0>] (newchrled_init [newchrled]) from [<80009704>] (do_one_initcall+0x80/0x1d8)
[<80009704>] (do_one_initcall) from [<8068ab70>] (do_init_module+0x58/0x1a8)
[<8068ab70>] (do_init_module) from [<80095e48>] (load_module+0x165c/0x1d48)
[<80095e48>] (load_module) from [<80096600>] (SyS_init_module+0xcc/0x124)
[<80096600>] (SyS_init_module) from [<8000f500>] (ret_fast_syscall+0x0/0x3c)
---[ end trace 685492c0becd195a ]---
------------[ cut here ]------------
WARNING: CPU: 0 PID: 76 at lib/kobject.c:240 kobject_add_internal+0x25c/0x2d8()
kobject_add_internal failed for newchrled with -EEXIST, don't try to register things with the same name in the same directory.
Modules linked in: newchrled(O+)
CPU: 0 PID: 76 Comm: modprobe Tainted: G W O 4.1.15 #4
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<80015ed4>] (unwind_backtrace) from [<80012794>] (show_stack+0x10/0x14)
[<80012794>] (show_stack) from [<8068cc84>] (dump_stack+0x80/0xc8)
[<8068cc84>] (dump_stack) from [<8003824c>] (warn_slowpath_common+0x74/0xb0)
[<8003824c>] (warn_slowpath_common) from [<800382b8>] (warn_slowpath_fmt+0x30/0x40)
[<800382b8>] (warn_slowpath_fmt) from [<8029e53c>] (kobject_add_internal+0x25c/0x2d8)
[<8029e53c>] (kobject_add_internal) from [<8029e670>] (kset_register+0x50/0x7c)
[<8029e670>] (kset_register) from [<8034e604>] (__class_register+0xa8/0x1bc)
[<8034e604>] (__class_register) from [<8034e758>] (__class_create+0x40/0x78)
[<8034e758>] (__class_create) from [<7f0061e0>] (newchrled_init+0x1e0/0x244 [newchrled])
[<7f0061e0>] (newchrled_init [newchrled]) from [<80009704>] (do_one_initcall+0x80/0x1d8)
[<80009704>] (do_one_initcall) from [<8068ab70>] (do_init_module+0x58/0x1a8)
[<8068ab70>] (do_init_module) from [<80095e48>] (load_module+0x165c/0x1d48)
[<80095e48>] (load_module) from [<80096600>] (SyS_init_module+0xcc/0x124)
[<80096600>] (SyS_init_module) from [<8000f500>] (ret_fast_syscall+0x0/0x3c)
---[ end trace 685492c0becd195b ]---
有个疑问,为什么有两个设备号出现(如上红色字体):
newchrled major=249, minor=0
newchrled major=248, minor=0
部分源码如下:
/* 自动创建设备节点 */
newchrled.class = class_create(THIS_MODULE, NEWCHRLED_NAME);
if(IS_ERR(newchrled.class))
return PTR_ERR(newchrled.class);
/* 自动创建设备 */
newchrled.device = device_create(newchrled.class, NULL, newchrled.devid,
NULL, NEWCHRLED_NAME);
if(IS_ERR(newchrled.device));
return PTR_ERR(newchrled.device);
添加了这段代码后,加载模块就会失败!
求大神解答!!!
|
|