Skip to content

Commit

Permalink
pcidev: remove pcidev_getdevfn() function
Browse files Browse the repository at this point in the history
This function is only called once. Move the content of the function into
the caller.

Change-Id: Id2983420080f75ae6992edfb032bf5c83b29c803
Signed-off-by: Thomas Heijligen <[email protected]>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/73570
Tested-by: build bot (Jenkins) <[email protected]>
Reviewed-by: Anastasia Klimchuk <[email protected]>
  • Loading branch information
heijligen committed Mar 10, 2023
1 parent 0e4d4ea commit 0e8902f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
3 changes: 2 additions & 1 deletion board_enable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,11 +1095,12 @@ static int nvidia_mcp_gpio_set(int gpio, int raise)
return -1;
}

dev = pcidev_getdevfn(dev, 1);
dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1);
if (!dev) {
msg_perr("MCP SMBus controller could not be found\n");
return -1;
}
pci_fill_info(dev, PCI_FILL_IDENT);
devclass = pci_read_word(dev, PCI_CLASS_DEVICE);
if (devclass != 0x0C05) {
msg_perr("Unexpected device class %04x for SMBus"
Expand Down
1 change: 0 additions & 1 deletion include/programmer.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ int pci_init_common(void);
uintptr_t pcidev_readbar(struct pci_dev *dev, int bar);
struct pci_dev *pcidev_init(const struct programmer_cfg *cfg, const struct dev_entry *devs, int bar);
struct pci_dev *pcidev_scandev(struct pci_filter *filter, struct pci_dev *start);
struct pci_dev *pcidev_getdevfn(struct pci_dev *dev, const int func);
struct pci_dev *pcidev_find_vendorclass(uint16_t vendor, uint16_t devclass);
struct pci_dev *pcidev_card_find(uint16_t vendor, uint16_t device, uint16_t card_vendor, uint16_t card_device);
struct pci_dev *pcidev_find(uint16_t vendor, uint16_t device);
Expand Down
8 changes: 0 additions & 8 deletions pcidev.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,6 @@ 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;
Expand Down

0 comments on commit 0e8902f

Please sign in to comment.