- 以RTC的probe过程为例
- linux内核版本5.9.0
- 执行路径如下
rtc@51 {
compatible = "nxp,pcf2129";
reg = <0x51>;
interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
}
module_init(pcf2127_init), drivers/rtc/rtc-pcf2127.c
-> pcf2127_init(), drivers/rtc/rtc-pcf2127.c
-> pcf2127_i2c_register_driver(), drivers/rtc/rtc-pcf2127.c
-> i2c_add_driver(&pcf2127_i2c_driver); drivers/rtc/rtc-pcf2127.c
-> i2c_register_driver(), include/linux/i2c.h
-> driver->driver.bus = &i2c_bus_type; drivers/i2c/i2c-core-base.c
-> struct bus_type i2c_bus_type = {..., .probe = i2c_device_probe,...}
-> driver_register(), drivers/base/driver.c
-> driver_find(), drivers/base/driver.c
-> bus_add_driver(), drivers/base/bus.c
-> driver_attach(), drivers/base/dd.c
-> __driver_attach(), drivers/base/dd.c
-> driver_match_device(),
-> drv->bus->match(), drivers/base/base.h
-> device_driver_attach(), drivers/base/dd.c
-> driver_probe_device(), drivers/base/dd.c
-> really_probe(), drivers/base/dd.c
-> dev->bus->probe(), drivers/base/dd.c
-> i2c_device_probe(), drivers/i2c/i2c-core-base.c
-> client->irq = client->init_irq; drivers/i2c/i2c-core-base.c
-> of_irq_get(), drivers/of/irq.c
-> of_property_read_u32_index(device, "interrupts",...), drivers/of/irq.c
-> client->irq = irq; drivers/i2c/i2c-core-base.c
-> driver->probe(), drivers/i2c/i2c-core-base.c
#define module_init(initfn)
static inline initcall_t __maybe_unused __inittest(void)
{ return initfn; }
int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
#define i2c_add_driver(driver)
i2c_register_driver(THIS_MODULE, driver)