.remove = __devexit_p(i2c_gpio_remove),
这里的__devexit_p有什么作用呢?
include/linux/init.h中找到了它的定义:
/* 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.
*/
#if defined(MODULE) || defined(CONFIG_HOTPLUG)
#define __devexit_p(x) x
#else
#define __devexit_p(x) NULL
#endif
意义是内核可能在不支持模块且不支持热插拔的时候,需要对 __devexit_p返回NULL。