is it possible to load module driver without it automatically binding to devices?




I wish to bind the drivers for devices in a specific bus ID order using the following command:

echo -n "<bus_id_1>" > /sys/bus/pci/drivers/<mydevice>/bind
echo -n "<bus_id_2>" > /sys/bus/pci/drivers/<mydevice>/bind
echo -n "<bus_id_n>" > /sys/bus/pci/drivers/<mydevice>/bind

I can do this now by unbinding all the devices and binding them in the order I desire, however, I would prefer to only bind the driver to these devices once (and in the order I desire).

Ideally, it would be nice to load the driver without it automatically binding.

Am I dreaming or is this possible?

Thanks in advance for any help.

One of the first things the kernel does when it loads a driver module is to call the probe function. This is what reports back what hardware is present that the driver will support. That decision is made by consulting a table of device IDs that the driver is capable of supporting. You can control this to some extent by limiting that table of supported devices to just the device you want the driver to work with. This means, of course, you have to compile it yourself.

Is this what you want?

Another approach is simply remove the modules from the lists of what to load at system startup time, then have a script that runs later and loads them as you want it done. To make that change, you'll need move the modules out of the file tree in /lib/modules/* to some other place, and use depmod to rebuild those lists. You can also modify modules.order to to get some control.

Members online