linux内核没有驱动源码,关于linux内核驱动源码里 __devexit 这个宏

2023-05-16

定义是:

#if defined(MODULE) || defined(CONFIG_HOTPLUG)     //可见这是要根据.config文件的内容来确定的。MODULE 和 CONFIG_HOTPLUG 都没有定义 ,name就等于是个NULL指针#define __devexit_p(x) x#else

#define __devexit_p(x) NULL#endif

/* Functions marked as __devexit may be discarded at kernel link time, depending

on config options.  Newer versions of binutils detect references from

retained sections to discarded sections and flag an error.  Pointers to

__devexit functions must use __devexit_p(function_name), the wrapper will

insert either the function_name or NULL, depending on the config options.

*/

内核注释里说:

被“__devexit”  标记的东西,可能在内核链接的时候被丢弃,是否丢弃取决于  config 选项。

有 “__devexit”  的函数指针,必须使用 __devexit_p(function_name)  的形式。 当然,有可能最终是函数名,也有可能被替换成了 NULL

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

linux内核没有驱动源码,关于linux内核驱动源码里 __devexit 这个宏 的相关文章

随机推荐