summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_wb.c
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2002-11-19 18:40:18 +0000
committerJason Wright <jason@cvs.openbsd.org>2002-11-19 18:40:18 +0000
commit6de774d6cba7e3cd5ab65ca8bd33d4e854d185ac (patch)
treee947e412c38cb1b45d34a5c858acb00564f371df /sys/dev/pci/if_wb.c
parentf8eb256c65fe796edfbbb90ae32c5502ca585795 (diff)
Add a simplistic table driven lookup routine and use it where appropriate.
Diffstat (limited to 'sys/dev/pci/if_wb.c')
-rw-r--r--sys/dev/pci/if_wb.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c
index 4f5d67211e9..1f4d8b53fbf 100644
--- a/sys/dev/pci/if_wb.c
+++ b/sys/dev/pci/if_wb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wb.c,v 1.18 2002/07/05 13:48:11 aaron Exp $ */
+/* $OpenBSD: if_wb.c,v 1.19 2002/11/19 18:40:17 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -708,6 +708,11 @@ wb_fixmedia(sc)
ifmedia_set(&mii->mii_media, media);
}
+const struct pci_matchid wb_devices[] = {
+ { PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C840F },
+ { PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_RL100ATX },
+};
+
/*
* Probe for a Winbond chip. Check the PCI vendor and device
* IDs against our list and return a device name if we find a match.
@@ -717,23 +722,8 @@ wb_probe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct pci_attach_args *pa = (struct pci_attach_args *)aux;
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_WINBOND) {
- switch (PCI_PRODUCT(pa->pa_id)) {
- case PCI_PRODUCT_WINBOND_W89C840F:
- return (1);
- }
- }
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_COMPEX) {
- switch (PCI_PRODUCT(pa->pa_id)) {
- case PCI_PRODUCT_COMPEX_RL100ATX:
- return (1);
- }
- }
-
- return (0);
+ return (pci_matchbyid((struct pci_attach_args *)aux, wb_devices,
+ sizeof(wb_devices)/sizeof(wb_devices[0])));
}
/*