On Sun, May 16, 2021 at 02:22:22AM +0530, Hritik Vijay wrote: > Hello > > I've experimented with two device drivers targeting a single device, > both hot-pluggable. When the device plugs in, both the modules are loaded. > This is expected behavior of udev. After being loaded, only one of the > drivers offered by them is chosen to be bound to the device > i.e. only one module gets to execute their `probe` function. > > I tried looking through the source to find out which module would get > the preference but I would really like some clarification on the > topic. > In what order will the kernel decide to give opportunities to device > drivers to bind to a device ? I believe this happens in the order that the drivers are registered. For drivers in modules, this will be the order in which the modules are loaded. In practice the loading order usually doesn't matter, because only one driver will be able to manage a particular device. For cases where there are two drivers capable of handling the same device, people usually have some sort of priority scheme to decide. For example, many USB mass-storage devices can be handled by either the usb-storage or the uas driver, but uas has higher priority. Alan Stern