summaryrefslogtreecommitdiff
path: root/sys/dev/cardbus/if_dc_cardbus.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-05-08 00:04:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-05-08 00:04:48 +0000
commit57efd2f155bb82e018e94616a1f98db1ca8d3b63 (patch)
tree63884e26431131319d6f2240aa62a11a2c1a7af4 /sys/dev/cardbus/if_dc_cardbus.c
parentbc8b161495cb90776e0b3f7ce36f7bb62e2795c8 (diff)
dc_detach() is only used by cardbus code, so move it there; ok jsg
Diffstat (limited to 'sys/dev/cardbus/if_dc_cardbus.c')
-rw-r--r--sys/dev/cardbus/if_dc_cardbus.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/sys/dev/cardbus/if_dc_cardbus.c b/sys/dev/cardbus/if_dc_cardbus.c
index e62b8095278..a85ab321380 100644
--- a/sys/dev/cardbus/if_dc_cardbus.c
+++ b/sys/dev/cardbus/if_dc_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_dc_cardbus.c,v 1.23 2006/10/12 16:35:52 grange Exp $ */
+/* $OpenBSD: if_dc_cardbus.c,v 1.24 2007/05/08 00:04:47 deraadt Exp $ */
#include <sys/param.h>
#include <sys/systm.h>
@@ -210,6 +210,31 @@ dc_cardbus_attach(parent, self, aux)
}
int
+dc_detach(sc)
+ 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);
+}
+
+int
dc_cardbus_detach(self, flags)
struct device *self;
int flags;