static void pci_scan_trad_caps(struct pci_dev *d) { word status = pci_read_word(d, PCI_STATUS);--------(1) byte been_there[256];-------------------------------------------(2) int where; if (!(status & PCI_STATUS_CAP_LIST))-------------------(3) return; memset(been_there, 0, 256);----------------------------------(4) where = pci_read_byte(d, PCI_CAPABILITY_LIST) & ~3;------(5) while (where) { byte id = pci_read_byte(d, where + PCI_CAP_LIST_ID); ------(6) byte next = pci_read_byte(d, where + PCI_CAP_LIST_NEXT) & ~3;-------(7) if (been_there[where]++)---------------------------------------------------------(8) break; if (id == 0xff)-------------------------------------------------------------------------(9) break; pci_add_cap(d, where, id, PCI_CAP_NORMAL);------------------------------(10) where = next;----------------------------------------------------------------------------(11) } }
if (been_there[where]++
break
这个有什么意义 不懂求大佬解释一下 言简意赅一些
if (been_there[where]++)//相当于判断been_there[where]是否为空,如果been_there[where]为空返回false ,if不成立,后面不执行。如果been_there[where]不为空,返回true,if成立,执行break
另外i++ 先使用i 再+1;++i 相当于i+1
能结合PCIE cap配置空间说下么。。不是很懂 谢谢大佬