- 论坛徽章:
- 2
|
举个例子:
/**
* pci_find_capability - query for devices' capabilities
* @dev: PCI device to query
* @cap: capability code
*
* Tell if a device supports a given PCI capability.
* Returns the address of the requested capability structure within the
* device's PCI configuration space or 0 in case the device does not
* support it. Possible values for @cap:
*
* %PCI_CAP_ID_PM Power Management
* %PCI_CAP_ID_AGP Accelerated Graphics Port
* %PCI_CAP_ID_VPD Vital Product Data
* %PCI_CAP_ID_SLOTID Slot Identification
* %PCI_CAP_ID_MSI Message Signalled Interrupts
* %PCI_CAP_ID_CHSWP CompactPCI HotSwap
* %PCI_CAP_ID_PCIX PCI-X
* %PCI_CAP_ID_EXP PCI Express
*/
int pci_find_capability(struct pci_dev *dev, int cap)
注释里一共列了8个可能的cap ID, 这估计是刚写该函数时写的注释。 后来kernel支持了更多的ID, 该注释却一直没有更新。 你查查kernel, 有很多传入其他ID的调用, 例如: pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); 这种写法,就是和注释矛盾的。
看代码时, 可以顺手发个小patch到 lkml |
|