diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2009-06-02 15:39:36 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2009-06-02 15:39:36 +0000 |
commit | 3073b2c274e79d673c8f4623f1884596b0a14f66 (patch) | |
tree | 471baff4ab475a0f1b0ca57a5c1aa8f79bdd55a5 /sys/dev/ic | |
parent | 39b8009aea39aeaa44d5bd629dd9ebdc573b2cfa (diff) |
make dc at pci detachable; untested.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/dc.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index c3e36634817..03ed39e7ca0 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.108 2009/01/11 16:54:59 blambert Exp $ */ +/* $OpenBSD: dc.c,v 1.109 2009/06/02 15:39:35 jsg Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -3142,6 +3142,30 @@ dc_power(int why, void *arg) splx(s); } +int +dc_detach(struct dc_softc *sc) +{ + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + if (LIST_FIRST(&sc->sc_mii.mii_phys) != NULL) + mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); + + if (sc->dc_srom) + free(sc->dc_srom, M_DEVBUF); + + timeout_del(&sc->dc_tick_tmo); + + ether_ifdetach(ifp); + if_detach(ifp); + + if (sc->sc_dhook != NULL) + shutdownhook_disestablish(sc->sc_dhook); + if (sc->sc_pwrhook != NULL) + powerhook_disestablish(sc->sc_pwrhook); + + return (0); +} + struct cfdriver dc_cd = { 0, "dc", DV_IFNET }; |