sys: Use is_pci_device instead of checking device or devclass names

Reviewed by:	bz, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D56998
This commit is contained in:
John Baldwin
2026-05-18 14:52:39 -04:00
parent 6dc813301a
commit be4f245e1e
2 changed files with 3 additions and 6 deletions
+1 -1
View File
@@ -628,7 +628,7 @@ ac97_initmixer(struct ac97_info *codec)
}
pdev = codec->dev;
while (strcmp(device_get_name(device_get_parent(pdev)), "pci") != 0) {
while (!is_pci_device(pdev)) {
/* find the top-level PCI device handler */
pdev = device_get_parent(pdev);
}
+2 -5
View File
@@ -548,16 +548,13 @@ tb_pci_probe(device_t dev)
{
struct tb_pcib_ident *n;
device_t parent;
devclass_t dc;
/*
* This driver is only valid if the parent device is a PCI-PCI
* bridge. To determine that, check if the grandparent is a
* PCI bus.
* bridge.
*/
parent = device_get_parent(dev);
dc = device_get_devclass(device_get_parent(parent));
if (strcmp(devclass_get_name(dc), "pci") != 0)
if (!is_pci_device(parent))
return (ENXIO);
if ((n = tb_pcib_find_ident(parent)) != NULL) {