summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-02 07:55:11 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-02 07:55:11 +0000
commit848c8c369f93d76df009ee1a63be736b68927a61 (patch)
tree1404c32b7a8ab405d711b2cf34e81e71242592ff /sys/dev/ic
parent47d0e90106fd53f5ed7d7475690413902775c006 (diff)
The xl_detach() function is now used by pci code, so it must be in the
shared code in case either cardbus or pci varients are not configured.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/xl.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c
index 1bb6f202107..cd1ae55e6b6 100644
--- a/sys/dev/ic/xl.c
+++ b/sys/dev/ic/xl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xl.c,v 1.85 2008/11/28 02:44:17 brad Exp $ */
+/* $OpenBSD: xl.c,v 1.86 2009/06/02 07:55:10 deraadt Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -2719,6 +2719,35 @@ xl_attach(struct xl_softc *sc)
sc->sc_pwrhook = powerhook_establish(xl_power, sc);
}
+int
+xl_detach(struct xl_softc *sc)
+{
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ extern void xl_freetxrx(struct xl_softc *);
+
+ /* Unhook our tick handler. */
+ timeout_del(&sc->xl_stsup_tmo);
+
+ xl_freetxrx(sc);
+
+ /* Detach all PHYs */
+ if (sc->xl_hasmii)
+ mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
+
+ /* Delete all 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);
+}
+
void
xl_shutdown(void *v)
{