问题描述
如何调用 probe()
调用?谁叫它?根据我的理解,__init()
注册 driver
然后以某种方式调用 probe()
来register
设备data 和 irq
等等.它到底是怎么发生的?
How does probe()
call gets called? Who calls it? As per my understanding, __init()
registers driver
and then somehow probe()
is called to register
the device data and irq
etc. How exactly it happens?
我正在开发触摸屏驱动程序,它的 __init
将自身注册到 i2c 驱动程序
.然后探测返回空值的expect i2c_clien
t 数据.我想跟踪它在哪里被填满.
I am working on touchscreen driver and its __init
registers itself to i2c driver
. Then probe expect i2c_clien
t data which returns null. I want to track where it gets filled.
推荐答案
长话短说:驱动程序的probe() 函数被调用作为为该特定总线调用register_driver
的结果.更准确地说,它由 bus_type
结构的 probe()
调用.在您的情况下:i2c_bus_type
.
Long story short: the probe() function of the driver is called as a result of calling the register_driver
for that specific bus. More precisely, it's called by the probe()
of that bus_type
structure. In your case: i2c_bus_type
.
这是您的 I2C 案例中的调用链:
Here's the call chain in your I2C case:
- i2c_register_driver
- driver_register
- bus_add_driver
- driver_attach
- __driver_attach(用于您的设备)
- driver_probe_device
- really_probe
- i2c_device_probe(这是用于 i2c 驱动程序的 dev->bus->probe)
- your_probe_function
这篇关于谁调用了驱动程序的probe()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!