IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    __devexit_p的功能

    Qiang发表于 2010-07-14 11:52:45
    love 0

    看驱动的时候,时常会有如下代码:
    .remove = __devexit_p(XX_exit),

    这里的__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

    注释已经说的狠明白了吧!



沪ICP备19023445号-2号
友情链接