I have seen in pci device drivers this line
module_pci_driver(cp_driver);
But in other pci device drivers this like
module_init(rtl8139_init_module);
both lines found at the end of driver's .c
file in different drivers
What I know is: I can create a pci device driver with __init
but I can also create a pci device driver without __init
i.e.
[Realtek Ethernet has two drivers in Linux source
1) 139cp.c (without __init
)
2) 8139too.c with __init
].
I assume that the main difference between the two is simply that if I have to use a pci device driver right after loading of the driver module with insmod
command so I use an implementation of a device driver with __init
.
Question
On the contrary, if I just want to load the pci device driver but not use it, Then should I create a pci device driver with module_pci_driver()
(So no need to add __init
)? And what does it do(module_pci_driver)? How its different from pci driver with __init
I like to know I may have a misconception anyone please clarify. Also does the probe
function of both type of drivers will run when I load the driver with insmod
command? When? if yes than what's the difference since most configuring of device is done in proble function
To sum up
When initialization happens in driver with module_pci_driver(cp_driver);
since they dont have __init
implemented. What command used
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…