在linux内核中,pci驱动程序的探测函数在哪里被调用

时间:2021-07-08 18:13:08

I browsed the __pci_register_driver() in pci-driver.c, but can't find the pci driver's probe() get called there. Which kernel function will call this probe() instead? Thanks!

我在pci-driver中浏览了__pci_register_driver()。c,但是在那里找不到pci驱动的probe()。哪个内核函数会调用这个探针()?谢谢!

2 个解决方案

#1


2  

In the same file pci-driver.c there is a function called

在同一个文件pci-driver中。有一个函数叫做

static long local_pci_probe(void *_ddi)
{
...
    rc = ddi->drv->probe(ddi->dev, ddi->id);
...
}

The call originates from struct bus_type pci_bus_type = { .probe = pci_device_probe }. First, pci_device_probe() calls __pci_device_probe(), which calls pci_call_probe(), which calls local_pci_probe(), which then calls the pci driver's probe().

调用来自struct bus_type pci_bus_type = {.probe = pci_device_probe}。首先,pci_device_probe()调用__pci_device_probe(),它调用pci_call_probe(),它调用local_pci_probe(),然后调用pci驱动程序的probe()。

#2


0  

  • prototype of _pci_register_driver is given in pci.h as follow:

    在pci中给出了_pci_register_driver的原型。h:

    #define pci_register_driver(driver) __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)

    #定义pci_register_driver(driver) __pci_register_driver(驱动程序,THIS_MODULE, KBUILD_MODNAME)

  • __pci_register_driver is defined in pci-driver.c

    __pci_register_driver是在pci-driver.c中定义的。

  • In some condition pci.h file is included in driver file and called by pci_register_driver function.There it is used..
  • 在一些条件pci。h文件包含在驱动文件中,并由pci_register_driver函数调用。有使用…

#1


2  

In the same file pci-driver.c there is a function called

在同一个文件pci-driver中。有一个函数叫做

static long local_pci_probe(void *_ddi)
{
...
    rc = ddi->drv->probe(ddi->dev, ddi->id);
...
}

The call originates from struct bus_type pci_bus_type = { .probe = pci_device_probe }. First, pci_device_probe() calls __pci_device_probe(), which calls pci_call_probe(), which calls local_pci_probe(), which then calls the pci driver's probe().

调用来自struct bus_type pci_bus_type = {.probe = pci_device_probe}。首先,pci_device_probe()调用__pci_device_probe(),它调用pci_call_probe(),它调用local_pci_probe(),然后调用pci驱动程序的probe()。

#2


0  

  • prototype of _pci_register_driver is given in pci.h as follow:

    在pci中给出了_pci_register_driver的原型。h:

    #define pci_register_driver(driver) __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)

    #定义pci_register_driver(driver) __pci_register_driver(驱动程序,THIS_MODULE, KBUILD_MODNAME)

  • __pci_register_driver is defined in pci-driver.c

    __pci_register_driver是在pci-driver.c中定义的。

  • In some condition pci.h file is included in driver file and called by pci_register_driver function.There it is used..
  • 在一些条件pci。h文件包含在驱动文件中,并由pci_register_driver函数调用。有使用…