1 2 | int count = 0; /* initialize common driver fields */ |
1 2 3 4 5 6 7 | drv->driver.name = drv->name; drv->driver.bus = &pci_bus_type; drv->driver.probe = pci_device_probe; drv->driver.remove = pci_device_remove; drv->driver.kobj.ktype = &pci_driver_kobj_type; pci_init_dynids(&drv->dynids); count = driver_register(&drv->driver); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | static struct pci_driver pcie_driver = { //驱动名称定义为"pciehp" .name= PCIE_MODULE_NAME, // id_table指定探测函数probe所应用的范围,这里在表中指定为所有的PCI桥设备 .id_table = pcied_pci_tbl, //probe为指定的设备探测函数 .probe = pcie_probe, }; static struct pci_device_id pcied_pci_tbl[] = { { //此处选择所有PCI桥 .class = ((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), .class_mask = ~0, .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, |
1 2 3 | static int pcie_probe (struct pci_dev *pdev, const struct pci_device_id *ent) in pcie-core.c |
1 2 3 4 | if (pushbutton_pending) pciehp_pushbutton_thread(pushbutton_pending); else if (surprise_rm_pending) pciehp_surprise_rm_thread(surprise_rm_pending); |
1 2 3 4 | static void pushbutton_helper_thread(unsigned long data) { pushbutton_pending = data; up(&event_semaphore); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |