summaryrefslogtreecommitdiff
path: root/util/superiotool/pci.c
blob: 0ca2887801b8aa6e4e652bdfda8cb79f8b96c832 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* This file is part of the superiotool project */
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include "superiotool.h"

struct pci_access *pacc;

struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device)
{
	struct pci_dev *temp;
	struct pci_filter filter;

	pci_filter_init(NULL, &filter);
	filter.vendor = vendor;
	filter.device = device;

	for (temp = pacc->devices; temp; temp = temp->next)
		if (pci_filter_match(&filter, temp))
			return temp;

	return NULL;
}