[iwm] make sure we call iwm_detach_local() only once.

Obtained from:	DragonflyBSD git ebd4ceab76a6f161362029cbfd08efaedaab0519
This commit is contained in:
adrian 2017-02-06 02:20:05 +00:00
parent 6cc4d7eb40
commit 835796a7f3
2 changed files with 6 additions and 0 deletions

View File

@ -5766,6 +5766,7 @@ iwm_attach(device_t dev)
int txq_i, i;
sc->sc_dev = dev;
sc->sc_attached = 1;
IWM_LOCK_INIT(sc);
mbufq_init(&sc->sc_snd, ifqmaxlen);
callout_init_mtx(&sc->sc_watchdog_to, &sc->sc_mtx, 0);
@ -6218,6 +6219,10 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211)
device_t dev = sc->sc_dev;
int i;
if (!sc->sc_attached)
return 0;
sc->sc_attached = 0;
if (do_net80211)
ieee80211_draintask(&sc->sc_ic, &sc->sc_es_task);

View File

@ -369,6 +369,7 @@ struct iwm_node {
struct iwm_softc {
device_t sc_dev;
uint32_t sc_debug;
int sc_attached;
struct mtx sc_mtx;
struct mbufq sc_snd;