简体   繁体   中英

Driver probe order in Linux Kernel

I have two drivers Dr1 and Dr2. My requirement is Dr1 probe has to call first then Dr2 probe can be called. As both Dr1 and Dr2 sources are in the same folder, I have added Dr1 entry first and Dr2 entry next in the Makefile(as show below).

obj-$(CONFIG_DR1) += dr1.0

obj-$(CONFIG_DR2) += dr2.0

With the above modification, Dr1 probe is calling first and Dr2 probe is calling next.

Is this approach is correct or any other way to achieve the same requirement? I am not sure, how driver and device binding is happen. My doubht is, if device for Dr2 comes first then Dr2 probe will be called first.

Could you please help me to understand how the device and driver binding will happen in Linux Kernel. We can control this order.

According to this SO answer , the order in the makefile is the correct approach to this.

See also this other SO answer for a detailed explanation of the mechanisms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM