“irq_to_desc” undefined?

来源:互联网 发布:安卓6.0java模拟器 编辑:程序博客网 时间:2024/05/13 12:24

    自己在编写内核模块后,make时产生了一个这样的错误:Error: "irq_to_desc"  [*.ko] undefined ! 在网上找了好久终于找到原因了。来自stackoverflow:

    I don't believe you can use irq_to_desc() in a module.   

    If CONFIG_GENERIC_HARDIRQS isn't defined, then irq_to_desc() is#defined as a macro in include/linux/irqnr.h. Since the variable it references,irq_desc, isn't in an EXPORT_SYMBOL or EXPORT_SYMBOL_GPL declaration, I don't think you could link a module using that variable into the kernel -- only statically compiled in-kernel code can use it.

    If CONFIG_GENERIC_HARDIRQS is defined, then a function irq_to_desc() is declared in include/linux/irqnr.h and defined inkernel/irq/irqdesc.c. There are two definitions of irq_to_desc() inkernel/irq/irqdesc.c depending upon the value of CONFIG_SPARSE_IRQ. There is no correspondingEXPORT_SYMBOL or EXPORT_SYMBOL_GPL declaration for the function, so it can't be used in modules -- only statically compiled in-kernel code.


    大意就是如果要在module中使用irq_to_desc()时,就必须把该模块编译进内核。


原创粉丝点击