diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2009-06-02 17:27:40 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2009-06-02 17:27:40 +0000 |
commit | 480e6d488fd326ab2dabdb02127a6b300d07795c (patch) | |
tree | 98ff9fa954b4c9ca2eb0241215a63ac47deeba58 /sys/dev/ic | |
parent | 8a695611f6f56d2cb8adf2bff424e36a79473c36 (diff) |
make rl at pci detachable; untested.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/rtl81x9.c | 28 | ||||
-rw-r--r-- | sys/dev/ic/rtl81x9reg.h | 3 |
2 files changed, 29 insertions, 2 deletions
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index aab49cea07c..7ef1c14f2b7 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9.c,v 1.63 2009/02/04 19:54:44 claudio Exp $ */ +/* $OpenBSD: rtl81x9.c,v 1.64 2009/06/02 17:27:39 jsg Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1445,6 +1445,32 @@ rl_tick(v) timeout_add_sec(&sc->sc_tick_tmo, 1); } +int +rl_detach(struct rl_softc *sc) +{ + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + /* Unhook our tick handler. */ + timeout_del(&sc->sc_tick_tmo); + + /* Detach any PHYs we might have. */ + if (LIST_FIRST(&sc->sc_mii.mii_phys) != NULL) + mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); + + /* Delete any remaining media. */ + ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); + + ether_ifdetach(ifp); + if_detach(ifp); + + if (sc->sc_sdhook != NULL) + shutdownhook_disestablish(sc->sc_sdhook); + if (sc->sc_pwrhook != NULL) + powerhook_disestablish(sc->sc_pwrhook); + + return (0); +} + struct cfdriver rl_cd = { 0, "rl", DV_IFNET }; diff --git a/sys/dev/ic/rtl81x9reg.h b/sys/dev/ic/rtl81x9reg.h index 1f300d728e2..776c2aa5225 100644 --- a/sys/dev/ic/rtl81x9reg.h +++ b/sys/dev/ic/rtl81x9reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9reg.h,v 1.60 2009/02/12 11:55:29 martynas Exp $ */ +/* $OpenBSD: rtl81x9reg.h,v 1.61 2009/06/02 17:27:39 jsg Exp $ */ /* * Copyright (c) 1997, 1998 @@ -996,3 +996,4 @@ struct rl_softc { extern int rl_attach(struct rl_softc *); extern int rl_intr(void *); extern void rl_setmulti(struct rl_softc *); +int rl_detach(struct rl_softc *); |