Attention is currently required from: Edward O'Callaghan. Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/59276 )
Change subject: pcidev: Move pci_get_dev() logic into canonical place ......................................................................
Patch Set 4: Code-Review+1
(1 comment)
File board_enable.c:
https://review.coreboot.org/c/flashrom/+/59276/comment/daf41a2b_12732784 PS4, Line 1097: pcidev_getdev1 Looks like you have named this function based on it's last argument which is `func`.
Possible to create one helper function as pcidev_getdevfn() and then pcidev_getdev1() calls into this with passing function number?
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func) { #if !defined(OLD_PCI_GET_DEV) return pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, func); #else /* pciutils/libpci before version 2.2 is too old to support * PCI domains. Such old machines usually don't have domains * besides domain 0, so this is not a problem. */ return pci_get_dev(pacc, dev->bus, dev->dev, func); #endif }
struct pci_dev *pcidev_getdev1(struct pci_dev *dev) { return pcidev_getdevfn(dev, 1); }
Then you can actually replace call pci_get_dev() function to pcidev_getdevfn() or pcidev_getdev1() as applicable?
$ grep -rsn "pci_get_dev" . ./pcidev.c:314: undo_pci_write_data->dev = pci_get_dev(pacc, \ ./chipset_enable.c:932: struct pci_dev *const spi_dev = pci_get_dev(pci_acc, dev->domain, dev->bus, slot, func); ./Makefile.d/pci_old_get_dev_test.c:15: dev = pci_get_dev(pacc, dev->bus, dev->dev, 1);