Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Add detach support.
details: https://anonhg.NetBSD.org/src/rev/2d4df778d80e
branches: trunk
changeset: 481581:2d4df778d80e
user: enami <enami%NetBSD.org@localhost>
date: Wed Feb 02 09:34:51 2000 +0000
description:
Add detach support.
diffstat:
sys/dev/ic/mb86960.c | 42 +++++++++++++++++++++++++++++++++---------
sys/dev/ic/mb86960var.h | 3 ++-
sys/dev/pcmcia/if_mbe_pcmcia.c | 16 ++++++----------
3 files changed, 41 insertions(+), 20 deletions(-)
diffs (128 lines):
diff -r b9fe66ceb65c -r 2d4df778d80e sys/dev/ic/mb86960.c
--- a/sys/dev/ic/mb86960.c Wed Feb 02 09:03:41 2000 +0000
+++ b/sys/dev/ic/mb86960.c Wed Feb 02 09:34:51 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mb86960.c,v 1.35 1999/09/13 10:31:35 itojun Exp $ */
+/* $NetBSD: mb86960.c,v 1.36 2000/02/02 09:34:52 enami Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -1106,7 +1106,8 @@
struct ifnet *ifp = &sc->sc_ec.ec_if;
u_char tstat, rstat;
- if (sc->sc_enabled == 0)
+ if (sc->sc_enabled == 0 ||
+ (sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
return (0);
#if FE_DEBUG >= 4
@@ -1812,6 +1813,11 @@
}
}
+/*
+ * mbe_activate:
+ *
+ * Handle device activation/deactivation requests.
+ */
int
mb86960_activate(self, act)
struct device *self;
@@ -1827,19 +1833,37 @@
break;
case DVACT_DEACTIVATE:
-#ifdef notyet
- /* First, kill off the interface. */
- if_detach(sc->sc_ec.ec_if);
-#endif
-
- /* Now disable the interface. */
- mb86960_disable(sc);
+ if_deactivate(&sc->sc_ec.ec_if);
break;
}
splx(s);
return (rv);
}
+/*
+ * mb86960_detach:
+ *
+ * Detach a MB86960 interface.
+ */
+int
+mb86960_detach(sc)
+ struct mb86960_softc *sc;
+{
+ struct ifnet *ifp = &sc->sc_ec.ec_if;
+
+ /* Delete all media. */
+ ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY);
+
+#if NBPFILTER > 0
+ bpfdetach(ifp);
+#endif
+ ether_ifdetach(ifp);
+ if_detach(ifp);
+
+ mb86960_disable(sc);
+ return (0);
+}
+
#if FE_DEBUG >= 1
void
mb86960_dump(level, sc)
diff -r b9fe66ceb65c -r 2d4df778d80e sys/dev/ic/mb86960var.h
--- a/sys/dev/ic/mb86960var.h Wed Feb 02 09:03:41 2000 +0000
+++ b/sys/dev/ic/mb86960var.h Wed Feb 02 09:34:51 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mb86960var.h,v 1.24 1999/03/25 23:19:16 thorpej Exp $ */
+/* $NetBSD: mb86960var.h,v 1.25 2000/02/02 09:34:52 enami Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -203,3 +203,4 @@
int mb86960_enable __P((struct mb86960_softc *));
void mb86960_disable __P((struct mb86960_softc *));
int mb86960_activate __P((struct device *, enum devact));
+int mb86960_detach __P((struct mb86960_softc *));
diff -r b9fe66ceb65c -r 2d4df778d80e sys/dev/pcmcia/if_mbe_pcmcia.c
--- a/sys/dev/pcmcia/if_mbe_pcmcia.c Wed Feb 02 09:03:41 2000 +0000
+++ b/sys/dev/pcmcia/if_mbe_pcmcia.c Wed Feb 02 09:34:51 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mbe_pcmcia.c,v 1.11 1999/11/29 02:28:19 jun Exp $ */
+/* $NetBSD: if_mbe_pcmcia.c,v 1.12 2000/02/02 09:34:51 enami Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -249,6 +249,11 @@
int flags;
{
struct mbe_pcmcia_softc *psc = (struct mbe_pcmcia_softc *)self;
+ int error;
+
+ error = mb86960_detach(&psc->sc_mb86960);
+ if (error != 0)
+ return (error);
/* Unmap our i/o window. */
pcmcia_io_unmap(psc->sc_pf, psc->sc_io_window);
@@ -256,16 +261,7 @@
/* Free our i/o space. */
pcmcia_io_free(psc->sc_pf, &psc->sc_pcioh);
-#ifdef notyet
- /*
- * Our softc is about to go away, so drop our reference
- * to the ifnet.
- */
- if_delref(psc->sc_mb86960.sc_ec.ec_if);
return (0);
-#else
- return (EBUSY);
-#endif
}
int
Home |
Main Index |
Thread Index |
Old Index