LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Where is a PCI module's Probe function called? (https://www.linuxquestions.org/questions/linux-general-1/where-is-a-pci-modules-probe-function-called-620925/)

jbreaka4lyfe 02-13-2008 04:13 PM

Where is a PCI module's Probe function called?
 
I am trying to write a PCIE driver, and am having trouble understanding where the probe function of struct pci_driver is called. In my init method for the module I do the following things:
  • register the character device
  • allocate memory for the device
  • setup the device's cdev
  • call pci_register_driver() passing in the pci_driver.

The value returned from the pci_register_driver() is 0, indicating a success. I am using printk to tell me when methods are called, and I noticed that probe is never called. When I install the module and then do a test write, the system's /var/log/messages show that the Init occurred, followed by an open, followed by a write, followed by a release. (These are all just stub code). But no where in there is the probe being called. I've seen mention that the PCI Core calls the probe, but I can't find when , where, and under what circumstances. This is my first time writing a device driver for Linux, I even read the O'Reilly book "Linux Device Drivers" but it didn't help out in this situation. Any help would be most appreciated. Thanks for taking your time to read this question.

jbreaka4lyfe 02-13-2008 07:14 PM

I found out the solution:

pci_register_driver will return 0 unless an error has occurred. But, if a device that matches your arguments hasn't been found that is NOT considered an error. Also, be careful to note that PCI cards are Little Endian and your architecture may be Big Endian. In my case, my architecture is Big Endian and there was a conversion going on behind the scenes in pci_register_driver causing my device not to be found. There ya go.

joslyn 05-18-2010 03:07 AM

but do you know who (from kernel level)is actually calling your driver's probe function when the correct match occurs?


All times are GMT -5. The time now is 10:54 AM.