summaryrefslogtreecommitdiff
path: root/sys/dev/cardbus
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-05-08 18:49:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-05-08 18:49:33 +0000
commitacd8e50c4bcc555e8c1d7f23d9a56d2715d99d83 (patch)
tree645ba00c5efd2e7e5140b880d5c800654518237e /sys/dev/cardbus
parentc894ae089084595dfb2b606a6ddcb4ac4a5f785d (diff)
rl_detach() is only used for cardbus case
Diffstat (limited to 'sys/dev/cardbus')
-rw-r--r--sys/dev/cardbus/if_rl_cardbus.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/sys/dev/cardbus/if_rl_cardbus.c b/sys/dev/cardbus/if_rl_cardbus.c
index 013ab6c29bd..505106fee15 100644
--- a/sys/dev/cardbus/if_rl_cardbus.c
+++ b/sys/dev/cardbus/if_rl_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rl_cardbus.c,v 1.15 2006/10/16 12:30:08 tom Exp $ */
+/* $OpenBSD: if_rl_cardbus.c,v 1.16 2007/05/08 18:49:32 deraadt Exp $ */
/* $NetBSD: if_rl_cardbus.c,v 1.3.8.3 2001/11/14 19:14:02 nathanw Exp $ */
/*
@@ -212,6 +212,35 @@ rl_cardbus_attach(parent, self, aux)
rl_attach(sc);
}
+extern int rl_detach(struct rl_softc *);
+
+int
+rl_detach(sc)
+ 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);
+}
+
int
rl_cardbus_detach(self, flags)
struct device *self;