diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-09-06 20:53:58 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-09-06 20:53:58 +0000 |
commit | ee121be7648a748314d652c30054183ed958aad1 (patch) | |
tree | 3e19eac6b77e5d58091242ce790b634ccbcbd0d0 /sys/dev | |
parent | 60cecfe3de2129547d64c8b4e4cfc9db710a4bac (diff) |
Add wi_detach, use it in pcmcia so that the shutdownhook is properly removed.
ok miod@ millert@ deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/if_wi.c | 21 | ||||
-rw-r--r-- | sys/dev/ic/if_wivar.h | 4 | ||||
-rw-r--r-- | sys/dev/pcmcia/if_wi_pcmcia.c | 5 |
3 files changed, 23 insertions, 7 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index 5b195d646cc..5078cff8daf 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.97 2003/08/15 20:32:17 tedu Exp $ */ +/* $OpenBSD: if_wi.c,v 1.98 2003/09/06 20:53:57 drahn Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -124,7 +124,7 @@ u_int32_t widebug = WIDEBUG; #if !defined(lint) && !defined(__OpenBSD__) static const char rcsid[] = - "$OpenBSD: if_wi.c,v 1.97 2003/08/15 20:32:17 tedu Exp $"; + "$OpenBSD: if_wi.c,v 1.98 2003/09/06 20:53:57 drahn Exp $"; #endif /* lint */ #ifdef foo @@ -391,7 +391,7 @@ wi_attach(sc) sizeof(struct ether_header)); #endif - shutdownhook_establish(wi_shutdown, sc); + sc->sc_sdhook = shutdownhook_establish(wi_shutdown, sc); wi_init(sc); wi_stop(sc); @@ -2390,6 +2390,21 @@ wi_watchdog(ifp) return; } +void +wi_detach(sc) + struct wi_softc *sc; +{ + struct ifnet *ifp; + ifp = &sc->sc_arpcom.ac_if; + + if (ifp->if_flags & IFF_RUNNING) + wi_stop(sc); + + sc->wi_flags &= ~WI_FLAGS_ATTACHED; + shutdownhook_disestablish(sc->sc_sdhook); + +} + STATIC void wi_shutdown(arg) void *arg; diff --git a/sys/dev/ic/if_wivar.h b/sys/dev/ic/if_wivar.h index f17bebdc0d6..f4c2edd94c2 100644 --- a/sys/dev/ic/if_wivar.h +++ b/sys/dev/ic/if_wivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wivar.h,v 1.20 2002/10/27 16:20:48 millert Exp $ */ +/* $OpenBSD: if_wivar.h,v 1.21 2003/09/06 20:53:57 drahn Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -108,6 +108,7 @@ struct wi_softc { u_int16_t wi_confbits; u_int16_t wi_confbits_param0; } wi_debug; + void *sc_sdhook; }; /* Values for wi_flags. */ @@ -126,6 +127,7 @@ struct wi_softc { #define WI_PRT_ARG(sc) (sc)->sc_dev.dv_xname int wi_attach(struct wi_softc *); +void wi_detach(struct wi_softc *); int wi_intr(void *); void wi_init(struct wi_softc *); void wi_stop(struct wi_softc *); diff --git a/sys/dev/pcmcia/if_wi_pcmcia.c b/sys/dev/pcmcia/if_wi_pcmcia.c index 4db761a37d7..008f4aa5a1b 100644 --- a/sys/dev/pcmcia/if_wi_pcmcia.c +++ b/sys/dev/pcmcia/if_wi_pcmcia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_pcmcia.c,v 1.42 2003/07/14 22:06:48 millert Exp $ */ +/* $OpenBSD: if_wi_pcmcia.c,v 1.43 2003/09/06 20:53:57 drahn Exp $ */ /* $NetBSD: if_wi_pcmcia.c,v 1.14 2001/11/26 04:34:56 ichiro Exp $ */ /* @@ -417,8 +417,7 @@ wi_pcmcia_detach(dev, flags) return (0); } - if (ifp->if_flags & IFF_RUNNING) - wi_stop(sc); + wi_detach(sc); sc->wi_flags = 0; |