I am inspecting linux driver code.
During initialization triggered by module_init(<driver_name>), at some point in later stage, the pci_register_driver is called. This is a part of linux kernel module I found. The first parameter is a linux driver structure which also must be standard.
There are members initialized for pci driver, including usual stuff like pci dev, vendor id.
The one I am paying attention to is .probe member and it is assigned to a function called <driver_name_probe>.
From the dmesg log after driver built and loaded, I can see <driver_name_probe> output sometime after registration.
What I am not sure in this instance is whether <driver_name_probe> is called as a result of, or during pci_register_driver or some other scheduling mechanism later once it is registered?
Does anyone have better knowledge on this?
I am too lazy to look at what pci_register_device is doing but earlier I did, there is at least one call to kobject_uevent() during registration which may possible hold the key.
The usual struc for pci driver:
static struct pci_driver <driver_name>_driver = {
.name = <driver_name>_driver_name,
.id_table = <driver_name>_pci_tbl,
.probe = <driver_name>probe,
.remove = <driver_name>remove,
.shutdown = <driver_name>shutdown,
.err_handler = &<driver_name>_err_handler
};
pci_register_driver std. linux function
-
- Member
- Posts: 396
- Joined: Wed Nov 18, 2015 3:04 pm
- Location: San Jose San Francisco Bay Area
- Contact:
pci_register_driver std. linux function
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails
-
- Member
- Posts: 5513
- Joined: Mon Mar 25, 2013 7:01 pm
Re: pci_register_driver std. linux function
I found this documentation that seems to explain it.ggodw000 wrote:What I am not sure in this instance is whether <driver_name_probe> is called as a result of, or during pci_register_driver or some other scheduling mechanism later once it is registered?
-
- Member
- Posts: 396
- Joined: Wed Nov 18, 2015 3:04 pm
- Location: San Jose San Francisco Bay Area
- Contact:
Re: pci_register_driver std. linux function
yeah i looked at it.
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails