前些天在中断响应(handle)函数中操作I2C的时候,发现内核会抱怨:
BUG: scheduling while atomic: samtest/0x00010000/57
Call Trace:[<c009a30>][<c009a30>][<c010f7f0>][<c010ed08>][<c010f7f0>][<c002e664>]
...
但是后面的操作依然正常,经过高手指点后发现原来通过I2C传输的时候,总线会休眠,英文说明:
* we can't acknowledge from interrupt context since the i2c
* bus controller may sleep, so we just disable the interrupt
* here and handle the acknowledge using delayed work.
查看如下代码中的说明:
所以采用先注册
然后在中断中调用