diff options
-rw-r--r-- | sys/dev/ic/elink3.c | 20 | ||||
-rw-r--r-- | sys/dev/ic/elink3var.h | 3 | ||||
-rw-r--r-- | sys/dev/pcmcia/if_ep_pcmcia.c | 11 |
3 files changed, 26 insertions, 8 deletions
diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index 4b750403021..7b5c8bc523b 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elink3.c,v 1.41 2000/07/06 00:59:01 todd Exp $ */ +/* $OpenBSD: elink3.c,v 1.42 2000/09/15 22:28:50 aaron Exp $ */ /* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */ /* @@ -446,6 +446,24 @@ epconfig(sc, chipset, enaddr) ep_reset_cmd(sc, EP_COMMAND, TX_RESET); } +int +ep_detach(self) + struct device *self; +{ + struct ep_softc *sc = (struct ep_softc *)self; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + if (sc->ep_flags & EP_FLAGS_MII) + mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); + + ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); + + ether_ifdetach(ifp); + if_detach(ifp); + + return (0); +} + /* * Find supported media on 3c509-generation hardware that doesn't have * a "reset_options" register in window 3. diff --git a/sys/dev/ic/elink3var.h b/sys/dev/ic/elink3var.h index beaa557aaf5..063a8875b1f 100644 --- a/sys/dev/ic/elink3var.h +++ b/sys/dev/ic/elink3var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: elink3var.h,v 1.14 2000/05/29 18:04:07 aaron Exp $ */ +/* $OpenBSD: elink3var.h,v 1.15 2000/09/15 22:28:51 aaron Exp $ */ /* $NetBSD: elink3var.h,v 1.12 1997/03/30 22:47:11 jonathan Exp $ */ /* @@ -92,3 +92,4 @@ void epconfig __P((struct ep_softc *, u_short, u_int8_t *)); int epintr __P((void *)); void epstop __P((struct ep_softc *)); void epinit __P((struct ep_softc *)); +int ep_detach __P((struct device *)); diff --git a/sys/dev/pcmcia/if_ep_pcmcia.c b/sys/dev/pcmcia/if_ep_pcmcia.c index 6a84b4c3893..ae8524b3574 100644 --- a/sys/dev/pcmcia/if_ep_pcmcia.c +++ b/sys/dev/pcmcia/if_ep_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ep_pcmcia.c,v 1.25 2000/06/28 18:03:37 millert Exp $ */ +/* $OpenBSD: if_ep_pcmcia.c,v 1.26 2000/09/15 22:28:52 aaron Exp $ */ /* $NetBSD: if_ep_pcmcia.c,v 1.16 1998/08/17 23:20:40 thorpej Exp $ */ /*- @@ -391,16 +391,15 @@ ep_pcmcia_detach(dev, flags) struct device *dev; int flags; { + int rv; struct ep_pcmcia_softc *psc = (struct ep_pcmcia_softc *)dev; - struct ep_softc *sc = &psc->sc_ep; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + if ((rv = ep_detach(dev)) != 0) + return (rv); pcmcia_io_unmap(psc->sc_pf, psc->sc_io_window); pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh); - ether_ifdetach(ifp); - if_detach(ifp); - return (0); } |