剛看了nandflash驅動,發現里面有兩個platform_driver結構體的初始化,當然也有兩個of_device_id匹配,和兩個probe函式,如下:
***********
static struct platform_driver atmel_nand_nfc_driver = {
.driver = {
.name = "atmel_nand_nfc",
.of_match_table = of_match_ptr(atmel_nand_nfc_match),
.pm = &atmel_nand_nfc_pm_ops,
},
.probe = atmel_nand_nfc_probe,
.remove = atmel_nand_nfc_remove,
};
******************
static struct platform_driver atmel_nand_driver = {
.probe = atmel_nand_probe,
.remove = atmel_nand_remove,
.driver = {
.name = "atmel_nand",
.of_match_table = of_match_ptr(atmel_nand_dt_ids),
.pm = &atmel_nand_pm_ops,
},
};
---------------------------
static const struct of_device_id atmel_nand_nfc_match[] = {
{ .compatible = "atmel,sama5d3-nfc" },
{ /* sentinel */ }
};
---------------------------
static const struct of_device_id atmel_nand_dt_ids[] = {
{ .compatible = "atmel,at91rm9200-nand", .data = &at91rm9200_caps},
};
那么問題也來了,都知道匹配成功后呼叫probe函式,可是當兩個of_device_id匹配成功后,他們都分別改呼叫哪個probe函式呢?以及用哪個platform_driver初始化的結構體呢?
uj5u.com熱心網友回復:
這個要看dtsi檔案里,引入了哪個of_device_id, 兩個of_device_id名字是不一樣的,你可以在dtsi里面grep下atmel,sama5d3-nfc和atmel,at91rm9200-nanduj5u.com熱心網友回復:
https://blog.csdn.net/weixin_42462202/article/details/86505992轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/143803.html
標籤:驅動程序開發區
