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

定义是:

 

#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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值