天嵌 ARM开发社区

 找回密码
 注册
查看: 3343|回复: 5

又遇到问题啦 高手请指点

[复制链接]
wang12zhedi 发表于 2012-9-12 10:13:40 | 显示全部楼层 |阅读模式
今天编译一个简单的驱动,但第一次insmod 时一切正常,然后我rmmod 再次加载同一个驱动时出问题啦
如下
[root@myself /]#cd lx/
[root@myself /lx]#insmod button.ko
buttoninit  
[root@myself /lx]#rmmod button.ko
[root@myself /lx]#insmod button.ko
------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:487 sysfs_add_one+0x68/0x90()
sysfs: cannot create duplicate filename '/class/button'
Modules linked in: button(+) [last unloaded: button]
[<c002b700>] (unwind_backtrace+0x0/0xdc) from [<c004454c>] (warn_slowpath_common+0x44/0x5c)
[<c004454c>] (warn_slowpath_common+0x44/0x5c) from [<c004459c>] (warn_slowpath_fmt+0x24/0x30)
[<c004459c>] (warn_slowpath_fmt+0x24/0x30) from [<c00ca018>] (sysfs_add_one+0x68/0x90)
[<c00ca018>] (sysfs_add_one+0x68/0x90) from [<c00ca5a8>] (create_dir+0x48/0x9c)
[<c00ca5a8>] (create_dir+0x48/0x9c) from [<c00ca630>] (sysfs_create_dir+0x34/0x50)
[<c00ca630>] (sysfs_create_dir+0x34/0x50) from [<c01340ac>] (kobject_add_internal+0xb8/0x18c)
[<c01340ac>] (kobject_add_internal+0xb8/0x18c) from [<c01341a0>] (kset_register+0x20/0x38)
[<c01341a0>] (kset_register+0x20/0x38) from [<c0177418>] (__class_register+0xb4/0x188)
[<c0177418>] (__class_register+0xb4/0x188) from [<c017752c>] (__class_create+0x40/0x68)
[<c017752c>] (__class_create+0x40/0x68) from [<bf009040>] (button_init+0x40/0x88 [button])
[<bf009040>] (button_init+0x40/0x88 [button]) from [<c00252a0>] (do_one_initcall+0x58/0x198)
[<c00252a0>] (do_one_initcall+0x58/0x198) from [<c00648e8>] (sys_init_module+0x8c/0x18c)
[<c00648e8>] (sys_init_module+0x8c/0x18c) from [<c0025d60>] (ret_fast_syscall+0x0/0x2c)
---[ end trace 84efe65d1bfe689b ]---
kobject_add_internal failed for button with -EEXIST, don't try to register things with the same name in the same directory.
[<c002b700>] (unwind_backtrace+0x0/0xdc) from [<c0134138>] (kobject_add_internal+0x144/0x18c)
[<c0134138>] (kobject_add_internal+0x144/0x18c) from [<c01341a0>] (kset_register+0x20/0x38)
[<c01341a0>] (kset_register+0x20/0x38) from [<c0177418>] (__class_register+0xb4/0x188)
[<c0177418>] (__class_register+0xb4/0x188) from [<c017752c>] (__class_create+0x40/0x68)
[<c017752c>] (__class_create+0x40/0x68) from [<bf009040>] (button_init+0x40/0x88 [button])
[<bf009040>] (button_init+0x40/0x88 [button]) from [<c00252a0>] (do_one_initcall+0x58/0x198)
[<c00252a0>] (do_one_initcall+0x58/0x198) from [<c00648e8>] (sys_init_module+0x8c/0x18c)
[<c00648e8>] (sys_init_module+0x8c/0x18c) from [<c0025d60>] (ret_fast_syscall+0x0/0x2c)
buttoninit  
[root@myself /lx]#
请大侠指点一下
embedsky_lhh 发表于 2012-9-12 10:27:20 | 显示全部楼层
你这个模块是用你板子上的这个内核编译出来的么?
回复

使用道具 举报

 楼主| wang12zhedi 发表于 2012-9-12 12:31:29 | 显示全部楼层
是的呀 板子上的内核是我自己移植的2.6.30.4的,移植之后生成zImage烧在板子上拉,编译模块用的也是这个内核
回复

使用道具 举报

 楼主| wang12zhedi 发表于 2012-9-12 17:50:20 | 显示全部楼层
应该是我编写的驱动的问题,刚才加载以前的驱动就没有这个问题
回复

使用道具 举报

亚瑟王 发表于 2012-9-15 15:19:16 | 显示全部楼层
wang12zhedi 发表于 2012-9-12 17:50
应该是我编写的驱动的问题,刚才加载以前的驱动就没有这个问题

你这个驱动是什么类型的?字符驱动吗?看加载的信息不像是字符驱动。
回复

使用道具 举报

 楼主| wang12zhedi 发表于 2012-9-15 18:05:15 | 显示全部楼层
刚开始学驱动,这是参考例子写的按键驱动,问题已经解决啦 ,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2025-10-29 06:03 , Processed in 2.039125 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表