调用led_blink_set出现的错误

皮CaPr 2011-05-19 08:16:16
在LED驱动中调用系统提供的接口led_blink_set,LED能够闪烁。但每次闪烁时都会出现如下错误:

BUG: sleeping function called from invalid context at drivers/gpio/gpiolib.c:1233
[ 6.780000] in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper
[ 6.780000] [<c0029a70>] (unwind_backtrace+0x0/0xe0) from [<c012b3c8>] (gpio_free+0x18/0x120)
[ 6.790000] [<c012b3c8>] (gpio_free+0x18/0x120) from [<c017a9f8>] (led_timer_function+0x80/0xa4)
[ 6.800000] [<c017a9f8>] (led_timer_function+0x80/0xa4) from [<c00418bc>] (run_timer_softirq+0x140/0x1e8)
[ 6.810000] [<c00418bc>] (run_timer_softirq+0x140/0x1e8) from [<c003c8e8>] (__do_softirq+0x7c/0x10c)
[ 6.820000] [<c003c8e8>] (__do_softirq+0x7c/0x10c) from [<c001f074>] (asm_do_IRQ+0x74/0x94)
[ 6.830000] [<c001f074>] (asm_do_IRQ+0x74/0x94) from [<c0024014>] (__irq_svc+0x34/0x80)
[ 6.840000] Exception stack(0xc020bf80 to 0xc020bfc8)
[ 6.840000] bf80: cee83000 00000000 c020bfc8 00000000 c020a000 c020e4cc c0223544 c020e4c4
[ 6.850000] bfa0: 5001b0ec 410fb766 5001b084 00000000 cf83c044 c020bfc8 c0025634 c0025458
[ 6.860000] bfc0: 60000013 ffffffff
[ 6.860000] [<c0024014>] (__irq_svc+0x34/0x80) from [<c0025458>] (default_idle+0x14/0x18)
[ 6.870000] [<c0025458>] (default_idle+0x14/0x18) from [<c0025634>] (cpu_idle+0x40/0x7c)
[ 6.880000] [<c0025634>] (cpu_idle+0x40/0x7c) from [<c00089d0>] (start_kernel+0x254/0x2a8)
[ 6.890000] [<c00089d0>] (start_kernel+0x254/0x2a8) from [<50008034>] (0x50008034)

[@SBC2410:/]#[ 8.090000] BUG: sleeping function called from invalid context at drivers/gpio/gpiolib.c:1233
[ 8.090000] in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper
[ 8.090000] [<c0029a70>] (unwind_backtrace+0x0/0xe0) from [<c012b3c8>] (gpio_free+0x18/0x120)
[ 8.100000] [<c012b3c8>] (gpio_free+0x18/0x120) from [<c017a9f8>] (led_timer_function+0x80/0xa4)
[ 8.110000] [<c017a9f8>] (led_timer_function+0x80/0xa4) from [<c00418bc>] (run_timer_softirq+0x140/0x1e8)
[ 8.120000] [<c00418bc>] (run_timer_softirq+0x140/0x1e8) from [<c003c8e8>] (__do_softirq+0x7c/0x10c)
[ 8.130000] [<c003c8e8>] (__do_softirq+0x7c/0x10c) from [<c001f074>] (asm_do_IRQ+0x74/0x94)
[ 8.140000] [<c001f074>] (asm_do_IRQ+0x74/0x94) from [<c0024014>] (__irq_svc+0x34/0x80)
[ 8.150000] Exception stack(0xc020bf80 to 0xc020bfc8)
[ 8.150000] bf80: cee83000 00000000 c020bfc8 00000000 c020a000 c020e4cc c0223544 c020e4c4
[ 8.160000] bfa0: 5001b0ec 410fb766 5001b084 00000000 cf890044 c020bfc8 c0025634 c0025458
[ 8.170000] bfc0: 60000013 ffffffff
[ 8.170000] [<c0024014>] (__irq_svc+0x34/0x80) from [<c0025458>] (default_idle+0x14/0x18)
[ 8.180000] [<c0025458>] (default_idle+0x14/0x18) from [<c0025634>] (cpu_idle+0x40/0x7c)
[ 8.190000] [<c0025634>] (cpu_idle+0x40/0x7c) from [<c00089d0>] (start_kernel+0x254/0x2a8)
[ 8.200000] [<c00089d0>] (start_kernel+0x254/0x2a8) from [<50008034>] (0x50008034)


有没有大侠找出错误的原因,或者解释下错误信息的意思..Thank you~
...全文
280 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
aria 2011-05-19
  • 打赏
  • 举报
回复
从你的堆栈信息看,应该是因为你的led_timer_function中调用了gpio_free,而gpio_free中会调用可能睡眠的函数,基于ISR/Tasklet不能调用会睡眠函数的原因,所以导致此错误。
皮CaPr 2011-05-19
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 aria 的回复:]
从你的堆栈信息看,应该是因为你的led_timer_function中调用了gpio_free,而gpio_free中会调用可能睡眠的函数,基于ISR/Tasklet不能调用会睡眠函数的原因,所以导致此错误。
[/Quote]

引用出错。
皮CaPr 2011-05-19
  • 打赏
  • 举报
回复
[Quote=引用楼主 zhangzhaocap 的回复:]
在LED驱动中调用系统提供的接口led_blink_set,LED能够闪烁。但每次闪烁时都会出现如下错误:

BUG: sleeping function called from invalid context at drivers/gpio/gpiolib.c:1233
[ 6.780000] in_atomic(): 1, irqs_disabled(): 0, pid: 0, name……
[/Quote]

果然是gpio_free出的问题。回去好好看看GPIO源码。

4,438

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧