summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2007-04-07 13:40:36 +0000
committerkrw <krw@openbsd.org>2007-04-07 13:40:36 +0000
commit21d76b08ebfa004e007af915b10313a50a59e30b (patch)
treee57bd838d4656b4924b750f94a23a67f7a2b7fb0
parentPermit PACKET command issue. (diff)
downloadwireguard-openbsd-21d76b08ebfa004e007af915b10313a50a59e30b.tar.xz
wireguard-openbsd-21d76b08ebfa004e007af915b10313a50a59e30b.zip
Use pci_matchbyid() rather than handrolled equivalent. From Brad.
tested & ok todd@
-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;