summaryrefslogtreecommitdiff
path: root/sys/dev/cardbus/if_fxp_cardbus.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-05-08 20:33:08 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-05-08 20:33:08 +0000
commit67e72c3378f0d327f4e61685dbd9415d4c0731a2 (patch)
treea240efbd16546d5f55dec0ca140793857d3d3c94 /sys/dev/cardbus/if_fxp_cardbus.c
parent34fa57004f4b21f9d683f260f1af64d1be4ba445 (diff)
put more foo_detach() routines where they are used
Diffstat (limited to 'sys/dev/cardbus/if_fxp_cardbus.c')
-rw-r--r--sys/dev/cardbus/if_fxp_cardbus.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/sys/dev/cardbus/if_fxp_cardbus.c b/sys/dev/cardbus/if_fxp_cardbus.c
index 37223d7ae18..1a3f97dc964 100644
--- a/sys/dev/cardbus/if_fxp_cardbus.c
+++ b/sys/dev/cardbus/if_fxp_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fxp_cardbus.c,v 1.18 2006/10/12 16:35:52 grange Exp $ */
+/* $OpenBSD: if_fxp_cardbus.c,v 1.19 2007/05/08 20:33:07 deraadt Exp $ */
/* $NetBSD: if_fxp_cardbus.c,v 1.12 2000/05/08 18:23:36 thorpej Exp $ */
/*
@@ -227,6 +227,34 @@ fxp_cardbus_setup(struct fxp_softc *sc)
}
int
+fxp_detach(struct fxp_softc *sc)
+{
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+
+ /* Unhook our tick handler. */
+ timeout_del(&sc->stats_update_to);
+
+ /* 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_powerhook != NULL)
+ powerhook_disestablish(sc->sc_powerhook);
+
+ return (0);
+}
+
+int fxp_detach(struct fxp_softc *);
+
+int
fxp_cardbus_detach(struct device *self, int flags)
{
struct fxp_softc *sc = (struct fxp_softc *) self;