Linux kernel 在哪里可以找到在Debian Stretch上构建网络驱动程序的pci_find_device()声明?

Linux kernel 在哪里可以找到在Debian Stretch上构建网络驱动程序的pci_find_device()声明?,linux-kernel,debian-stretch,network-driver,Linux Kernel,Debian Stretch,Network Driver,我正在尝试构建一个网络驱动程序。然而,当我尝试构建它时,它说: error: implicit declaration of function ‘pci_find_device 这是我的司机: #定义REALTEK_VENDER_ID 0x10EC #定义REALTEK_设备_ID 0x8139 #包括 #包括 #包括 #包括 int init_模块(void) { 结构pci_dev*pdev; pdev=pci查找设备(REALTEK供应商ID,REALTEK设备ID,NULL); 如果(

我正在尝试构建一个网络驱动程序。然而,当我尝试构建它时,它说:

error: implicit declaration of function ‘pci_find_device
这是我的司机:

#定义REALTEK_VENDER_ID 0x10EC
#定义REALTEK_设备_ID 0x8139
#包括
#包括
#包括
#包括
int init_模块(void)
{
结构pci_dev*pdev;
pdev=pci查找设备(REALTEK供应商ID,REALTEK设备ID,NULL);
如果(!pdev)
printk(“未找到设备\n”);
其他的
printk(“找到设备\n”);
返回0;
}
模块许可证(“GPL”);
这是我的Makefile

obj-m += ethDriver.o

all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
生成时,我会出现以下错误:

ethDriver.c: In function ‘init_module’:
/home/xxx/ethDriver/ethDriver.c:13:12: error: implicit declaration of function ‘pci_find_device’ [-Werror=implicit-function-declaration]
     pdev = pci_find_device(REALTEK_VENDER_ID, REALTEK_DEVICE_ID, NULL);
            ^~~~~~~~~~~~~~~
/home/xxx/ethDriver/ethDriver.c:13:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     pdev = pci_find_device(REALTEK_VENDER_ID, REALTEK_DEVICE_ID, NULL);
          ^
cc1: some warnings being treated as errors
/usr/src/linux-headers-4.9.0-3-common/scripts/Makefile.build:315: recipe for target '/home/xxx/ethDriver/ethDriver.o' failed
make[4]: *** [/home/xxx/ethDriver/ethDriver.o] Error 1
/usr/src/linux-headers-4.9.0-3-common/Makefile:1507: recipe for target '_module_/home/xxx/ethDriver' failed
make[3]: *** [_module_/home/xxx/ethDriver] Error 2
Makefile:150: recipe for target 'sub-make' failed
make[2]: *** [sub-make] Error 2
Makefile:8: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.9.0-3-amd64'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2
内核v2.6.34中删除了
pci\u find\u device()
函数

发件人:

过时的功能

在尝试使用时,可能会遇到几个函数 将旧的驱动程序移植到新的PCI接口。他们不再是 存在于内核中,因为它们与热插拔或PCI不兼容 域或具有健全的锁定

pci_find_device() Superseded by pci_get_device()
pci_find_subsys() Superseded by pci_get_subsys()
pci_find_slot()   Superseded by pci_get_domain_bus_and_slot()
pci_get_slot()    Superseded by pci_get_domain_bus_and_slot()
您需要使用,它也应该包含在

/**
*pci_获取_设备-开始或继续按供应商/设备id搜索pci设备
*@vendor:PCI供应商id匹配,或%PCI\u ANY\u id匹配所有供应商id
*@device:PCI设备id匹配,或%PCI\u ANY\u id匹配所有设备id
*@from:在搜索中找到以前的PCI设备,或在新搜索中找到%NULL。
*
*遍历已知PCI设备的列表。如果PCI设备是
*使用匹配的@vendor和@device找到,引用计数为
*设备将递增,并返回指向其设备结构的指针。
*否则,将返回%NULL。通过传递%NULL启动新的搜索
*作为@from参数。否则,如果@from不是%NULL,则继续搜索
*来自全局列表上的下一个设备。@from的引用计数为
*如果不是%NULL,则始终递减。
*/
结构pci_dev*pci_get_设备(未签名整数供应商、未签名整数设备、,
结构pci_dev*from)
{
返回pci_get_subsys(供应商、设备、pci_任意ID、pci_任意ID、发件人);
}
导出符号(pci获取设备);
注:您的
#define
有输入错误,它可能应该是
供应商
,而不是
供应商