Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Make sure to get rid of shutdown hook and ttach medi...



details:   https://anonhg.NetBSD.org/src/rev/5d07bb8322f9
branches:  trunk
changeset: 481571:5d07bb8322f9
user:      augustss <augustss%NetBSD.org@localhost>
date:      Wed Feb 02 08:00:21 2000 +0000

description:
Make sure to get rid of shutdown hook and ttach media on detach.

diffstat:

 sys/dev/ic/elink3.c           |  18 ++++++++++++++++--
 sys/dev/ic/elink3var.h        |   5 ++++-
 sys/dev/pcmcia/if_ep_pcmcia.c |   7 ++++++-
 3 files changed, 26 insertions(+), 4 deletions(-)

diffs (83 lines):

diff -r eae84941b9e8 -r 5d07bb8322f9 sys/dev/ic/elink3.c
--- a/sys/dev/ic/elink3.c       Wed Feb 02 07:47:33 2000 +0000
+++ b/sys/dev/ic/elink3.c       Wed Feb 02 08:00:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elink3.c,v 1.67 1999/11/19 18:17:14 thorpej Exp $      */
+/*     $NetBSD: elink3.c,v 1.68 2000/02/02 08:00:21 augustss Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -520,7 +520,7 @@
        sc->tx_start_thresh = 20;       /* probably a good starting point. */
 
        /*  Establish callback to reset card when we reboot. */
-       shutdownhook_establish(epshutdown, sc);
+       sc->shutdown_hook = shutdownhook_establish(epshutdown, sc);
 
        ep_reset_cmd(sc, ELINK_COMMAND, RX_RESET);
        ep_reset_cmd(sc, ELINK_COMMAND, TX_RESET);
@@ -2132,6 +2132,20 @@
        return (rv);
 }
 
+int
+ep_detach(self, flags)
+       struct device *self;
+       int flags;
+{
+       struct ep_softc *sc = (struct ep_softc *)self;
+
+       shutdownhook_disestablish(sc->shutdown_hook);
+
+       ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
+
+       return (0);
+}
+
 u_int32_t
 ep_mii_bitbang_read(self)
        struct device *self;
diff -r eae84941b9e8 -r 5d07bb8322f9 sys/dev/ic/elink3var.h
--- a/sys/dev/ic/elink3var.h    Wed Feb 02 07:47:33 2000 +0000
+++ b/sys/dev/ic/elink3var.h    Wed Feb 02 08:00:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elink3var.h,v 1.21 1998/11/18 18:34:52 thorpej Exp $   */
+/*     $NetBSD: elink3var.h,v 1.22 2000/02/02 08:00:22 augustss Exp $  */
 
 /*
  * Copyright (c) 1994 Herb Peyerl <hpeyerl%beer.org@localhost>
@@ -100,6 +100,8 @@
        rndsource_element_t rnd_source;
 #endif
 
+       void *shutdown_hook;
+
        /* power management hooks */
        int (*enable) __P((struct ep_softc *));
        void (*disable) __P((struct ep_softc *));
@@ -116,3 +118,4 @@
 void   epdisable __P((struct ep_softc *));
 
 int    ep_activate __P((struct device *, enum devact));
+int    ep_detach __P((struct device *, int flags));
diff -r eae84941b9e8 -r 5d07bb8322f9 sys/dev/pcmcia/if_ep_pcmcia.c
--- a/sys/dev/pcmcia/if_ep_pcmcia.c     Wed Feb 02 07:47:33 2000 +0000
+++ b/sys/dev/pcmcia/if_ep_pcmcia.c     Wed Feb 02 08:00:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ep_pcmcia.c,v 1.26 2000/02/02 07:47:33 itojun Exp $ */
+/*     $NetBSD: if_ep_pcmcia.c,v 1.27 2000/02/02 08:00:23 augustss Exp $       */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -412,6 +412,11 @@
        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);
+       if (rv)
+               return (rv);
 
        /* Unmap our i/o window. */
        pcmcia_io_unmap(psc->sc_pf, psc->sc_io_window);



Home | Main Index | Thread Index | Old Index