__unregister, ...) \static int __init __driver##_init(void) \{ \return __register(&(__driver) , ##__VA_ARGS__); \} \module_init(__driver##_init); \static void __exit __driver##_exit(void) \{ \__unregister(&(__driver) , ##__VA_ARGS__); \} \module_exit(__driv...
* module_driver() - Helper macro for drivers that don't do anything * special in module init/exit. This eliminates a lot of boilerplate. * Each module may only use this macro once, and calling it replaces * module_init() and module_exit(). * * @__driver: driver name * @__regi...
* anything special in module init/exit. This eliminates a lot of * boilerplate. Each module may only use this macro once, and * calling it replaces module_init() and module_exit() */ #define module_platform_driver(__platform_driver) \ module_driver(__platform_driver, platform_driver_re...
方式二: /* module_platform_driver() - Helper macro for drivers that don't do* anything special in module init/exit. This eliminates a lot of* boilerplate. Each module may only use this macro once, and* calling it replaces module_init() and module_exit()*/#define module_platform_drive...
使用module_platform_driver宏时,还需要在模块初始化函数中调用它,如下所示: c Copy code static int __init my_driver_init(void) { return module_platform_driver(my_platform_driver); } 在模块退出函数中,不需要调用platform_driver_unregister函数,因为这个函数已经被module_platform_driver宏自动提供了。©...
platform_device 是在系统启动时在init.c 里的s3c_arch_init() 函数里进行注册的。这个函数申明为arch_initcall(s3c_arch_init); 会在系统初始化阶段被调用。arch_initcall 的优先级高于module_init,所以会在Platform 驱动注册之前调用。现在内核中不是采用arch_initcall(s3c_arch_init) 注册platform_device 结构体...
static int __init axp288_extcon_init(void) { return platform_driver_register(&axp288_extcon_driver); } module_init(axp288_extcon_init); static void __exit axp288_extcon_exit(void) { platform_driver_unregister(&axp288_extcon_driver); } module_exit(axp288_extcon_exit); module_platform_dr...
.c--- load_module()module_init:module_init() defined ininclude\/linux/\module.hfn是module_init的参数,fn是一个...;config->name); ... return 0; }Platformdriver-kernel/include/linux/platform_device.h#define Linux设备驱动程序架构分析之MMC/SD(一) plain...
> -static int __init sec_pmic_init(void) > -{ > - return i2c_add_driver(&sec_pmic_driver); > -} > - > -subsys_initcall(sec_pmic_init); > - > -static void __exit sec_pmic_exit(void) > -{ > - i2c_del_driver(&sec_pmic_driver); ...
.remove = cpsw_remove, }; -static int __init cpsw_init(void) -{ - return platform_driver_register(&cpsw_driver); -} -late_initcall(cpsw_init); - -static void __exit cpsw_exit(void) -{ - platform_driver_unregister(&cpsw_driver); ...