- 论坛徽章:
- 0
|
所有的powerpc 的I2C适配器驱动都在/driver/i2c/busses/I2c-mpc.c文件中。
适配器的驱动是of_platform_driver,
/* Structure for a device driver */
static struct of_platform_driver mpc_i2c_driver = {
.match_table = mpc_i2c_of_match,
.probe = fsl_i2c_probe,
.remove = __devexit_p(fsl_i2c_remove),
.driver = {
.owner = THIS_MODULE,
.name = DRV_NAME,//mpc-i2c
},
};
在这里我们看一下of_platform_bus_type,
struct bus_type of_platform_bus_type = {
.uevent = of_device_uevent,
};
可以看到,这里没有match方法。
module_init(fsl_i2c_init) -> fsl_i2c_init -> of_register_platform_driver(&mpc_i2c_driver)
在这里会调用of_platform总线的match函数of_platform_bus_match去做设备和驱动的匹配,
of_platform_bus_match函数在比较了驱动的match-table和设备node中的相关字段后( compatible = "fsl-i2c" ),若匹配,进入fsl_i2c_probe。但是我们看到在这里of_platform总线的结构体里没有match方法。是不是在注册适配器的时候是不要match设备的名子的?
|
|