diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2005-05-16 01:36:26 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2005-05-16 01:36:26 +0000 |
commit | 043fdf63d284376eee040ff4b6b189925cc4c02d (patch) | |
tree | a34ce84180044e71fd8fc39c06ac65b7c0153f64 /sys/dev/cardbus/if_rtw_cardbus.c | |
parent | 0415649f3817db0cec17a3c5fa33df846eee2015 (diff) |
Use cardbus_matchbyid().
ok millert@ jsg@
Diffstat (limited to 'sys/dev/cardbus/if_rtw_cardbus.c')
-rw-r--r-- | sys/dev/cardbus/if_rtw_cardbus.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/sys/dev/cardbus/if_rtw_cardbus.c b/sys/dev/cardbus/if_rtw_cardbus.c index 92ed6c4baf4..9aef539f7d3 100644 --- a/sys/dev/cardbus/if_rtw_cardbus.c +++ b/sys/dev/cardbus/if_rtw_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtw_cardbus.c,v 1.4 2005/02/10 12:14:53 jsg Exp $ */ +/* $OpenBSD: if_rtw_cardbus.c,v 1.5 2005/05/16 01:36:25 brad Exp $ */ /* $NetBSD: if_rtw_cardbus.c,v 1.4 2004/12/20 21:05:34 dyoung Exp $ */ /*- @@ -166,38 +166,18 @@ int rtw_cardbus_enable(struct rtw_softc *); void rtw_cardbus_disable(struct rtw_softc *); void rtw_cardbus_power(struct rtw_softc *, int); -const struct rtw_cardbus_product *rtw_cardbus_lookup( - const struct cardbus_attach_args *); - -const struct rtw_cardbus_product { - u_int32_t rcp_vendor; /* PCI vendor ID */ - u_int32_t rcp_product; /* PCI product ID */ -} rtw_cardbus_products[] = { +const struct cardbus_matchid rtw_cardbus_devices[] = { { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180 }, { PCI_VENDOR_BELKIN2, PCI_PRODUCT_BELKIN2_F5D6020V3 }, { PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DWL610 }, - { 0, 0 } }; -const struct rtw_cardbus_product * -rtw_cardbus_lookup(const struct cardbus_attach_args *ca) -{ - const struct rtw_cardbus_product *rcp; - - for (rcp = rtw_cardbus_products; rcp->rcp_product != 0; rcp++) { - if (PCI_VENDOR(ca->ca_id) == rcp->rcp_vendor && - PCI_PRODUCT(ca->ca_id) == rcp->rcp_product) - return (rcp); - } - return (NULL); -} - int rtw_cardbus_match(struct device *parent, void *match, void *aux) { - struct cardbus_attach_args *ca = aux; - - return (rtw_cardbus_lookup(ca) != NULL); + return (cardbus_matchbyid((struct cardbus_attach_args *)aux, + rtw_cardbus_devices, + sizeof(rtw_cardbus_devices)/sizeof(rtw_cardbus_devices[0]))); } void @@ -228,7 +208,6 @@ rtw_cardbus_attach(struct device *parent, struct device *self, void *aux) struct rtw_regs *regs = &sc->sc_regs; struct cardbus_attach_args *ca = aux; cardbus_devfunc_t ct = ca->ca_ct; - const struct rtw_cardbus_product *rcp; bus_addr_t adr; int rev; @@ -236,12 +215,6 @@ rtw_cardbus_attach(struct device *parent, struct device *self, void *aux) csc->sc_ct = ct; csc->sc_tag = ca->ca_tag; - rcp = rtw_cardbus_lookup(ca); - if (rcp == NULL) { - printf("\n"); - panic("rtw_cardbus_attach: impossible"); - } - /* * Power management hooks. */ |