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()时,就必须把该模块编译进内核。