Driver的prob的调用顺序
http://blog.csdn.net/aaronychen/article/details/2109966
Driver的注冊
?
Driver的prob的調用順序
可以從bus_attach_device()看起,
1 bus_attach_device()調用device_attach(dev)
2 device_attach(): 調用bus_for_each_drv()遍歷bus上的每個driver,當找到一個driver則用__device_attach()來判斷是否匹配
3 __device_attach(): 直接調用driver_probe_device(drv, dev)
4 driver_probe_device(): 首先如果driver所在總線有match函數則先調用這個match來匹配,如不匹配則直接返回錯誤,否則接著調用really_probe(dev,drv)
5 really_probe(): 先判斷dev所在總線是否有probe函數,有則調用它來匹配,失敗則返回,正確則成功,如果總線沒有probe則判斷drv是否有probe函數,有則調用并匹配它.
6 drv->prob(): ?一般它是一類設備的probe,在它里面它會調用具體某個drv的probe函數,這個函數是在我們的驅動程序里面注冊的.??
?? 下面以usb acm驅動為例:
<!--[if !supportLists]-->1??? <!--[endif]-->注冊: usb_register()注冊我們的usb_driver對象;里面含有一個probe函數.并含有一個device_driver對象(其實這個對象才是真正注冊到系統理的驅動對象)
<!--[if !supportLists]-->2??? <!--[endif]-->Usb_register(): 調用usb_register_driver()
<!--[if !supportLists]-->3??? <!--[endif]-->usb_register_driver(): 填充device_driver對象(包括一個usb_probe_interface函數,即USB設備類通用的probe函數), 最后通過driver_register注冊這個device_driver.
Probe過程.
<!--[if !vml]--><!--[endif]-->
新的usb設備連上機器后, hub_port_connect_change會被調用
?
總結
以上是生活随笔為你收集整理的Driver的prob的调用顺序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 设计美学 第二章 设计的媒介力量
- 下一篇: 海龟交易法(期货)