From: Joerg Sonnenberger Date: Mon, 20 Jun 2005 13:01:15 +0000 (+0000) Subject: - initialise interface name early X-Git-Tag: v2.0.1~6856 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/ebe47c702920a02b86d7e63bf43ae2539c137b77 - initialise interface name early - use common PCI probe style - remove unused vr_info and vr_type field from softc Submitted-by: Sepherosa Ziehau --- diff --git a/sys/dev/netif/vr/Makefile b/sys/dev/netif/vr/Makefile index 72fd793d95..218c930210 100644 --- a/sys/dev/netif/vr/Makefile +++ b/sys/dev/netif/vr/Makefile @@ -1,7 +1,6 @@ # $FreeBSD: src/sys/modules/vr/Makefile,v 1.8 2000/01/28 11:26:42 bde Exp $ -# $DragonFly: src/sys/dev/netif/vr/Makefile,v 1.2 2003/06/17 04:28:47 dillon Exp $ +# $DragonFly: src/sys/dev/netif/vr/Makefile,v 1.3 2005/06/20 13:01:15 joerg Exp $ -.PATH: ${.CURDIR}/../../pci KMOD = if_vr SRCS = if_vr.c opt_bdg.h device_if.h bus_if.h pci_if.h SRCS += miibus_if.h diff --git a/sys/dev/netif/vr/if_vr.c b/sys/dev/netif/vr/if_vr.c index f80be2fc7e..750b017d3d 100644 --- a/sys/dev/netif/vr/if_vr.c +++ b/sys/dev/netif/vr/if_vr.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_vr.c,v 1.26.2.13 2003/02/06 04:46:20 silby Exp $ - * $DragonFly: src/sys/dev/netif/vr/if_vr.c,v 1.27 2005/06/11 04:26:53 hsu Exp $ + * $DragonFly: src/sys/dev/netif/vr/if_vr.c,v 1.28 2005/06/20 13:01:15 joerg Exp $ */ /* @@ -668,16 +668,16 @@ static int vr_probe(device_t dev) { struct vr_type *t; + uint16_t vid, did; - t = vr_devs; + vid = pci_get_vendor(dev); + did = pci_get_device(dev); - while(t->vr_name != NULL) { - if ((pci_get_vendor(dev) == t->vr_vid) && - (pci_get_device(dev) == t->vr_did)) { + for (t = vr_devs; t->vr_name != NULL; ++t) { + if (vid == t->vr_vid && did == t->vr_did) { device_set_desc(dev, t->vr_name); return(0); } - t++; } return(ENXIO); @@ -793,6 +793,9 @@ vr_attach(device_t dev) */ VR_CLRBIT(sc, VR_STICKHW, (VR_STICKHW_DS0|VR_STICKHW_DS1)); + ifp = &sc->arpcom.ac_if; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + /* Reset the adapter. */ vr_reset(sc); @@ -804,9 +807,6 @@ vr_attach(device_t dev) pci_read_config(dev, VR_PCI_MODE, 4) | (VR_MODE3_MIION << 24), 4); VR_CLRBIT(sc, VR_MIICMD, VR_MIICMD_AUTOPOLL); - ifp = &sc->arpcom.ac_if; - if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - /* * Get station address. The way the Rhine chips work, * you're not allowed to directly access the EEPROM once diff --git a/sys/dev/netif/vr/if_vrreg.h b/sys/dev/netif/vr/if_vrreg.h index 45d17333ae..9e73ceb2c3 100644 --- a/sys/dev/netif/vr/if_vrreg.h +++ b/sys/dev/netif/vr/if_vrreg.h @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/if_vrreg.h,v 1.7.2.5 2003/02/06 04:46:20 silby Exp $ - * $DragonFly: src/sys/dev/netif/vr/if_vrreg.h,v 1.6 2005/05/05 22:57:45 swildner Exp $ + * $DragonFly: src/sys/dev/netif/vr/if_vrreg.h,v 1.7 2005/06/20 13:01:15 joerg Exp $ */ /* @@ -461,8 +461,6 @@ struct vr_softc { struct resource *vr_irq; void *vr_intrhand; device_t vr_miibus; - struct vr_type *vr_info; /* Rhine adapter info */ - uint8_t vr_type; uint8_t vr_revid; /* Rhine chip revision */ uint8_t vr_flags; /* See VR_F_* below */ struct vr_list_data *vr_ldata;