OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 2:35 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: pci_register_driver std. linux function
PostPosted: Fri Oct 02, 2020 11:59 am 
Offline
Member
Member

Joined: Wed Nov 18, 2015 3:04 pm
Posts: 396
Location: San Jose San Francisco Bay Area
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
};

_________________
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


Top
 Profile  
 
 Post subject: Re: pci_register_driver std. linux function
PostPosted: Fri Oct 02, 2020 4:09 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
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?

I found this documentation that seems to explain it.


Top
 Profile  
 
 Post subject: Re: pci_register_driver std. linux function
PostPosted: Tue Oct 13, 2020 12:26 am 
Offline
Member
Member

Joined: Wed Nov 18, 2015 3:04 pm
Posts: 396
Location: San Jose San Francisco Bay Area
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 45 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group