当前位置: 技术问答>linux和unix
调用led_blink_set出现的错误
来源: 互联网 发布时间:2016-11-30
本文导语: 在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, ...
在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] [] (unwind_backtrace+0x0/0xe0) from [] (gpio_free+0x18/0x120)
[ 6.790000] [] (gpio_free+0x18/0x120) from [] (led_timer_function+0x80/0xa4)
[ 6.800000] [] (led_timer_function+0x80/0xa4) from [] (run_timer_softirq+0x140/0x1e8)
[ 6.810000] [] (run_timer_softirq+0x140/0x1e8) from [] (__do_softirq+0x7c/0x10c)
[ 6.820000] [] (__do_softirq+0x7c/0x10c) from [] (asm_do_IRQ+0x74/0x94)
[ 6.830000] [] (asm_do_IRQ+0x74/0x94) from [] (__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] [] (__irq_svc+0x34/0x80) from [] (default_idle+0x14/0x18)
[ 6.870000] [] (default_idle+0x14/0x18) from [] (cpu_idle+0x40/0x7c)
[ 6.880000] [] (cpu_idle+0x40/0x7c) from [] (start_kernel+0x254/0x2a8)
[ 6.890000] [] (start_kernel+0x254/0x2a8) from [] (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] [] (unwind_backtrace+0x0/0xe0) from [] (gpio_free+0x18/0x120)
[ 8.100000] [] (gpio_free+0x18/0x120) from [] (led_timer_function+0x80/0xa4)
[ 8.110000] [] (led_timer_function+0x80/0xa4) from [] (run_timer_softirq+0x140/0x1e8)
[ 8.120000] [] (run_timer_softirq+0x140/0x1e8) from [] (__do_softirq+0x7c/0x10c)
[ 8.130000] [] (__do_softirq+0x7c/0x10c) from [] (asm_do_IRQ+0x74/0x94)
[ 8.140000] [] (asm_do_IRQ+0x74/0x94) from [] (__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] [] (__irq_svc+0x34/0x80) from [] (default_idle+0x14/0x18)
[ 8.180000] [] (default_idle+0x14/0x18) from [] (cpu_idle+0x40/0x7c)
[ 8.190000] [] (cpu_idle+0x40/0x7c) from [] (start_kernel+0x254/0x2a8)
[ 8.200000] [] (start_kernel+0x254/0x2a8) from [] (0x50008034)
有没有大侠找出错误的原因,或者解释下错误信息的意思..Thank you~
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] [] (unwind_backtrace+0x0/0xe0) from [] (gpio_free+0x18/0x120)
[ 6.790000] [] (gpio_free+0x18/0x120) from [] (led_timer_function+0x80/0xa4)
[ 6.800000] [] (led_timer_function+0x80/0xa4) from [] (run_timer_softirq+0x140/0x1e8)
[ 6.810000] [] (run_timer_softirq+0x140/0x1e8) from [] (__do_softirq+0x7c/0x10c)
[ 6.820000] [] (__do_softirq+0x7c/0x10c) from [] (asm_do_IRQ+0x74/0x94)
[ 6.830000] [] (asm_do_IRQ+0x74/0x94) from [] (__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] [] (__irq_svc+0x34/0x80) from [] (default_idle+0x14/0x18)
[ 6.870000] [] (default_idle+0x14/0x18) from [] (cpu_idle+0x40/0x7c)
[ 6.880000] [] (cpu_idle+0x40/0x7c) from [] (start_kernel+0x254/0x2a8)
[ 6.890000] [] (start_kernel+0x254/0x2a8) from [] (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] [] (unwind_backtrace+0x0/0xe0) from [] (gpio_free+0x18/0x120)
[ 8.100000] [] (gpio_free+0x18/0x120) from [] (led_timer_function+0x80/0xa4)
[ 8.110000] [] (led_timer_function+0x80/0xa4) from [] (run_timer_softirq+0x140/0x1e8)
[ 8.120000] [] (run_timer_softirq+0x140/0x1e8) from [] (__do_softirq+0x7c/0x10c)
[ 8.130000] [] (__do_softirq+0x7c/0x10c) from [] (asm_do_IRQ+0x74/0x94)
[ 8.140000] [] (asm_do_IRQ+0x74/0x94) from [] (__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] [] (__irq_svc+0x34/0x80) from [] (default_idle+0x14/0x18)
[ 8.180000] [] (default_idle+0x14/0x18) from [] (cpu_idle+0x40/0x7c)
[ 8.190000] [] (cpu_idle+0x40/0x7c) from [] (start_kernel+0x254/0x2a8)
[ 8.200000] [] (start_kernel+0x254/0x2a8) from [] (0x50008034)
有没有大侠找出错误的原因,或者解释下错误信息的意思..Thank you~
|
从你的堆栈信息看,应该是因为你的led_timer_function中调用了gpio_free,而gpio_free中会调用可能睡眠的函数,基于ISR/Tasklet不能调用会睡眠函数的原因,所以导致此错误。