From e1cdbdbbfb98a28fe7198ae6cd3e571269a04403 Mon Sep 17 00:00:00 2001 From: Thomas Heijligen Date: Tue, 14 Mar 2023 10:45:27 +0100 Subject: Revert "pcidev: remove pcidev_getdevfn() function" As Edward pointed out correctly this function does more than abstracting the different versions of `pci_get_dev()`. It also hide the usage of the global `struct pci_access pacc` from the caller. This reverts commit 0e8902f1ff2b927bb91a5e89e4fde3d8d71f6692. Change-Id: I0cd2f54cb6a6e35dc353476e0f5e502cbbd06cba Signed-off-by: Thomas Heijligen Reviewed-on: https://review.coreboot.org/c/flashrom/+/73730 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan Reviewed-by: Anastasia Klimchuk --- pcidev.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pcidev.c') diff --git a/pcidev.c b/pcidev.c index 68da3278..696510ed 100644 --- a/pcidev.c +++ b/pcidev.c @@ -190,6 +190,14 @@ struct pci_dev *pcidev_find(uint16_t vendor, uint16_t device) return pcidev_scandev(&filter, NULL); } +struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func) +{ + struct pci_dev *const new = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, func); + if (new) + pci_fill_info(new, PCI_FILL_IDENT); + return new; +} + struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass) { struct pci_dev *temp = NULL; -- cgit v1.2.3