summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-04-07 13:40:37 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-04-07 13:40:37 +0000
commit8a53e7f021b0b1522503c7c114d6931677f78d38 (patch)
tree1822609b570242e6f44c6c79d70a91c9d781cfd6 /sys
parent29d71ba328e7445e1d16043cccb1b89a0b8b8494 (diff)
Use pci_matchbyid() rather than handrolled equivalent. From Brad.
tested & ok todd@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_bce.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c
index ed76b04b95a..f177b1428d1 100644
--- a/sys/dev/pci/if_bce.c
+++ b/sys/dev/pci/if_bce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bce.c,v 1.14 2006/11/08 01:32:00 brad Exp $ */
+/* $OpenBSD: if_bce.c,v 1.15 2007/04/07 13:40:36 krw Exp $ */
/* $NetBSD: if_bce.c,v 1.3 2003/09/29 01:53:02 mrg Exp $ */
/*
@@ -217,16 +217,10 @@ struct cfdriver bce_cd = {
#define APRINT_NORMAL printf
#endif
-static int
-bce_lookup(const struct pci_attach_args *pa)
-{
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_BROADCOM &&
- (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM4401 ||
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM4401B0))
- return 1;
-
- return 0;
-}
+const struct pci_matchid bce_devices[] = {
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4401 },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4401B0 }
+};
int
bce_probe(parent, match, aux)
@@ -234,9 +228,8 @@ bce_probe(parent, match, aux)
void *match;
void *aux;
{
- struct pci_attach_args *pa = (struct pci_attach_args *)aux;
-
- return bce_lookup(pa);
+ return (pci_matchbyid((struct pci_attach_args *)aux, bce_devices,
+ sizeof(bce_devices)/sizeof(bce_devices[0])));
}
void
@@ -261,8 +254,6 @@ bce_attach(parent, self, aux)
int error;
int i;
- KASSERT(bce_lookup(pa));
-
sc->bce_pa = *pa;
sc->bce_dmatag = pa->pa_dmat;