在module_i2c_driver()的调用链中,我无法找到将参数传递给函数adxl34x_i2c_probe()的位置。
static int adxl34x_i2c_probe(struct i2c_client *client,
78 const struct i2c_device_id *id)
79 {
...
99 return 0;
100 }
158 static struct i2c_driver adxl34x_driver = {
159 .driver = {
160 .name = "adxl34x",
161 .owner = THIS_MODULE,
162 .pm = &adxl34x_i2c_pm,
163 .of_match_table = of_match_ptr(adxl34x_of_id),
164 },
165 .probe = adxl34x_i2c_probe,
166 .remove = adxl34x_i2c_remove,
167 .id_table = adxl34x_id,
168 };
169
170 module_i2c_driver(adxl34x_driver);
答案 0 :(得分:0)
i2c_driver
函数(http://lxr.free-electrons.com/source/drivers/i2c/i2c-core.c#L632)调用 probe
' i2c_device_probe
回调。
用
.probe = adxl34x_i2c_probe
您将probe
的回调函数指针设置为指向adx134x_i2c_probe
,因此使用传递的参数调用driver->probe
(http://lxr.free-electrons.com/source/drivers/i2c/i2c-core.c#L672}实际上是在调用{{1使用相同的参数。