Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-13-2008, 04:13 PM   #1
LQ Newbie
Registered: Feb 2008
Location: San Diego, CA
Posts: 15

Rep: Reputation: 0
Question 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.
Old 02-13-2008, 07:14 PM   #2
LQ Newbie
Registered: Feb 2008
Location: San Diego, CA
Posts: 15

Original Poster
Rep: Reputation: 0
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.
Old 05-18-2010, 03:07 AM   #3
LQ Newbie
Registered: Apr 2010
Posts: 4

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript function disappears after getting called for once mohtasham1983 Programming 1 01-15-2008 08:31 AM
segfault caused depending on how a function is called emge1 Programming 6 04-04-2007 03:48 PM
what is the kernel function called when a file is created viv_nan Linux - General 2 03-08-2007 06:09 AM
USB driver won't call probe function linux=future Linux - Kernel 2 01-13-2007 04:47 PM
USB Driver Probe function not being called xtom Fedora 0 10-28-2005 03:48 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration