summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-05-05 13:24:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-05-05 13:24:05 +0000
commit62ab3e9b4b9342adc5bc2b31ad2847e58e4000d5 (patch)
tree5b33213b7faedf59514a83f60c6f3dfe0bb3a3ff
parent990f3c7e22987e27aa666a5d466867d109c6b229 (diff)
move xl_detach() -- which is only used by cardbus -- to the cardbus code.
ok jsg
-rw-r--r--sys/dev/cardbus/if_xl_cardbus.c31
-rw-r--r--sys/dev/ic/xl.c30
2 files changed, 31 insertions, 30 deletions
diff --git a/sys/dev/cardbus/if_xl_cardbus.c b/sys/dev/cardbus/if_xl_cardbus.c
index c32295198c4..c0f40391bd7 100644
--- a/sys/dev/cardbus/if_xl_cardbus.c
+++ b/sys/dev/cardbus/if_xl_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xl_cardbus.c,v 1.18 2006/10/12 16:35:52 grange Exp $ */
+/* $OpenBSD: if_xl_cardbus.c,v 1.19 2007/05/05 13:24:03 deraadt Exp $ */
/* $NetBSD: if_xl_cardbus.c,v 1.13 2000/03/07 00:32:52 mycroft Exp $ */
/*
@@ -304,6 +304,35 @@ xl_cardbus_attach(struct device *parent, struct device *self, void *aux)
}
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);
+}
+
+int
xl_cardbus_detach(struct device *self, int arg)
{
struct xl_cardbus_softc *csc = (void *)self;
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c
index 250eaa30ef0..bfce9c21945 100644
--- a/sys/dev/ic/xl.c
+++ b/sys/dev/ic/xl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xl.c,v 1.76 2006/08/10 20:10:18 brad Exp $ */
+/* $OpenBSD: xl.c,v 1.77 2007/05/05 13:24:04 deraadt Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -2742,34 +2742,6 @@ 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;
-
- /* 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)
{