外设篇之bq25890

module_i2c_driver(bq25890_driver);----------------------------------------------/kernel/drivers/power/yl_bq25890.c

   --> #definemodule_i2c_driver(__i2c_driver) module_driver(__i2c_driver, i2c_add_driver,i2c_del_driver)-----------------------/kernel/include/linux/i2c.h

      { #definemodule_i2c_driver(bq25890_driver) module_driver(bq25890_driver, i2c_add_driver,i2c_del_driver)}

       -->-----------------------/kernel/include/linux/device.h

#definemodule_driver(__driver, __register, __unregister, ...) \

staticint __init __driver##_init(void) \

{\

return__register(&(__driver) , ##__VA_ARGS__); \

}\

module_init(__driver##_init);\

staticvoid __exit __driver##_exit(void) \

{\

__unregister(&(__driver), ##__VA_ARGS__); \

}\

module_exit(__driver##_exit);

 

{

#definemodule_driver(bq25890_driver, i2c_add_driver, i2c_del_driver) \

static int __initbq25890_driver_init(void) \

{ \

return i2c_add_driver(&bq25890_driver ,##__VA_ARGS__); \

} \

module_init(bq25890_driver_init);\

static void __exitbq25890_driver_exit(void) \

{ \

i2c_del_driver(&bq25890_driver ,##__VA_ARGS__); \

} \

module_exit(bq25890_driver_exit);

}

 

 

-->#define i2c_add_driver(driver)i2c_register_driver(THIS_MODULE, driver)   ------------------------------>/kernel/include/linux/i2c.h

   {#definei2c_add_driver(bq25890_driver)i2c_register_driver(THIS_MODULE, bq25890_driver)}

 

    -->i2c_register_driver(THIS_MODULE, bq25890_driver)----------------------------------/kernel/drivers/i2c/i2c-core.c

 

 

你可能感兴趣的:(linux-外设篇,linux-电源管理篇)