- 論壇徽章:
- 0
|
所有的powerpc 的I2C適配器驅(qū)動都在/driver/i2c/busses/I2c-mpc.c文件中。
適配器的驅(qū)動是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)
在這里會調(diào)用of_platform總線的match函數(shù)of_platform_bus_match去做設(shè)備和驅(qū)動的匹配,
of_platform_bus_match函數(shù)在比較了驅(qū)動的match-table和設(shè)備node中的相關(guān)字段后( compatible = "fsl-i2c" ),若匹配,進入fsl_i2c_probe。但是我們看到在這里of_platform總線的結(jié)構(gòu)體里沒有match方法。是不是在注冊適配器的時候是不要match設(shè)備的名子的?
|
|