Re: Order in which kernel decides binding device driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux