diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2026-05-18 18:52:23 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2026-05-18 18:52:23 +0000 |
| commit | 6dc813301a173e2e1993c3064df162e6218c1231 (patch) | |
| tree | 8416dfcfe0481ac2a06eb075cda5f9a1414c77e3 /sys/dev/pci | |
| parent | ffcf5e356644252f2f6c89ba01057af45c216559 (diff) | |
sys: Use is_pci_device instead of direct comparisons to devclasses
Reviewed by: bz
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D56997
Diffstat (limited to 'sys/dev/pci')
| -rw-r--r-- | sys/dev/pci/pci.c | 10 | ||||
| -rw-r--r-- | sys/dev/pci/vga_pci.c | 6 |
2 files changed, 4 insertions, 12 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index adf3daea66fd..034f34e2dde2 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -6535,11 +6535,9 @@ device_t pci_find_pcie_root_port(device_t dev) { struct pci_devinfo *dinfo; - devclass_t pci_class; device_t pcib, bus; - pci_class = devclass_find("pci"); - KASSERT(device_get_devclass(device_get_parent(dev)) == pci_class, + KASSERT(is_pci_device(dev), ("%s: non-pci device %s", __func__, device_get_nameunit(dev))); /* @@ -6555,11 +6553,7 @@ pci_find_pcie_root_port(device_t dev) KASSERT(pcib != NULL, ("%s: null bridge of %s", __func__, device_get_nameunit(bus))); - /* - * pcib's parent must be a PCI bus for this to be a - * PCI-PCI bridge. - */ - if (device_get_devclass(device_get_parent(pcib)) != pci_class) + if (!is_pci_device(pcib)) return (NULL); dinfo = device_get_ivars(pcib); diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index 39b2fcab67b4..72c93e201d96 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -111,8 +111,7 @@ vga_pci_is_boot_display(device_t dev) */ pcib = device_get_parent(device_get_parent(dev)); - if (device_get_devclass(device_get_parent(pcib)) == - devclass_find("pci")) { + if (is_pci_device(pcib)) { /* * The parent bridge is a PCI-to-PCI bridge: check the * value of the "VGA Enable" bit. @@ -186,8 +185,7 @@ vga_pci_map_bios(device_t dev, size_t *size) #endif pcib = device_get_parent(device_get_parent(dev)); - if (device_get_devclass(device_get_parent(pcib)) == - devclass_find("pci")) { + if (is_pci_device(pcib)) { /* * The parent bridge is a PCI-to-PCI bridge: check the * value of the "VGA Enable" bit. |
