Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Move detach operations around a little to simplify (...
details: https://anonhg.NetBSD.org/src/rev/aea6d9ceafbf
branches: trunk
changeset: 481578:aea6d9ceafbf
user: augustss <augustss%NetBSD.org@localhost>
date: Wed Feb 02 08:41:00 2000 +0000
description:
Move detach operations around a little to simplify (and perhaps get it
right?). Prompted by Jason, itojun and myself.
diffstat:
sys/dev/ic/elink3.c | 23 +++++++++++++----------
sys/dev/pcmcia/if_ep_pcmcia.c | 42 +++++-------------------------------------
2 files changed, 18 insertions(+), 47 deletions(-)
diffs (143 lines):
diff -r c8d58c75251d -r aea6d9ceafbf sys/dev/ic/elink3.c
--- a/sys/dev/ic/elink3.c Wed Feb 02 08:36:02 2000 +0000
+++ b/sys/dev/ic/elink3.c Wed Feb 02 08:41:00 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3.c,v 1.69 2000/02/02 08:05:26 thorpej Exp $ */
+/* $NetBSD: elink3.c,v 1.70 2000/02/02 08:41:00 augustss Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -2110,6 +2110,7 @@
enum devact act;
{
struct ep_softc *sc = (struct ep_softc *)self;
+ struct ifnet *ifp = &sc->sc_ethercom.ec_if;
int rv = 0, s;
s = splnet();
@@ -2119,13 +2120,7 @@
break;
case DVACT_DEACTIVATE:
-#ifdef notyet
- /* First, kill off the interface. */
- if_detach(sc->sc_ethercom.ec_if);
-#endif
-
- /* Now disable the interface. */
- epdisable(sc);
+ if_deactivate(ifp);
break;
}
splx(s);
@@ -2138,11 +2133,19 @@
int flags;
{
struct ep_softc *sc = (struct ep_softc *)self;
+ struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+
+ epdisable(sc);
+
+ ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
+#if NBPFILTER > 0
+ bpfdetach(ifp);
+#endif
+ ether_ifdetach(ifp);
+ if_detach(ifp);
shutdownhook_disestablish(sc->shutdown_hook);
- ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
-
return (0);
}
diff -r c8d58c75251d -r aea6d9ceafbf sys/dev/pcmcia/if_ep_pcmcia.c
--- a/sys/dev/pcmcia/if_ep_pcmcia.c Wed Feb 02 08:36:02 2000 +0000
+++ b/sys/dev/pcmcia/if_ep_pcmcia.c Wed Feb 02 08:41:00 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ep_pcmcia.c,v 1.27 2000/02/02 08:00:23 augustss Exp $ */
+/* $NetBSD: if_ep_pcmcia.c,v 1.28 2000/02/02 08:41:01 augustss Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -119,7 +119,6 @@
int ep_pcmcia_match __P((struct device *, struct cfdata *, void *));
void ep_pcmcia_attach __P((struct device *, struct device *, void *));
int ep_pcmcia_detach __P((struct device *, int));
-int ep_pcmcia_activate __P((struct device *, enum devact));
int ep_pcmcia_get_enaddr __P((struct pcmcia_tuple *, void *));
int ep_pcmcia_enable __P((struct ep_softc *));
@@ -139,7 +138,7 @@
struct cfattach ep_pcmcia_ca = {
sizeof(struct ep_pcmcia_softc), ep_pcmcia_match, ep_pcmcia_attach,
- ep_pcmcia_detach, ep_pcmcia_activate
+ ep_pcmcia_detach, ep_activate
};
struct ep_pcmcia_product {
@@ -264,8 +263,9 @@
struct ep_pcmcia_softc *psc = (struct ep_pcmcia_softc *) sc;
ep_pcmcia_disable1(sc);
- pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
- sc->sc_ih = 0;
+ if (sc->sc_ih != NULL)
+ pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
+ sc->sc_ih = NULL;
}
void
@@ -381,37 +381,11 @@
}
int
-ep_pcmcia_activate(dev, act)
- struct device *dev;
- enum devact act;
-{
- struct ep_pcmcia_softc *sc = (struct ep_pcmcia_softc *)dev;
- int s;
- int rv = 0;
-
- s = splnet();
- switch (act) {
- case DVACT_ACTIVATE:
- rv = EOPNOTSUPP;
- break;
-
- case DVACT_DEACTIVATE:
- if (sc->sc_ep.sc_ih != NULL)
- ep_pcmcia_disable((void *)sc);
- break;
- }
- splx(s);
- return (rv);
-}
-
-int
ep_pcmcia_detach(self, flags)
struct device *self;
int flags;
{
struct ep_pcmcia_softc *psc = (struct ep_pcmcia_softc *)self;
- struct ep_softc *sc = &psc->sc_ep;
- struct ifnet *ifp = &sc->sc_ethercom.ec_if;
int rv;
rv = ep_detach(self, flags);
@@ -424,12 +398,6 @@
/* Free our i/o space. */
pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh);
-#if NBPFILTER > 0
- bpfdetach(ifp);
-#endif
- ether_ifdetach(ifp);
- if_detach(ifp);
-
return (0);
}
Home |
Main Index |
Thread Index |
Old Index