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 in
kernel/irq/irqdesc.c. There are two definitions of irq_to_desc() in
kernel/irq/irqdesc.c depending upon the value of CONFIG_SPARSE_IRQ. There is no corresponding
EXPORT_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()时,就必须把该模块编译进内核。
本文探讨了在内核模块中使用irq_to_desc()函数时遇到的问题及其解决方法。主要原因是该函数在不同配置下定义方式不同,导致模块无法直接引用。文章详细解释了配置条件及解决策略。

1777

被折叠的 条评论
为什么被折叠?



