diff options
-rw-r--r-- | sys/dev/usb/if_zyd.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/if_zydreg.h | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 57dce28..cc6c607 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -268,7 +268,7 @@ zyd_attachhook(struct zyd_softc *sc) return error; } - sc->sc_flags |= ZD1211_FWLOADED; + sc->sc_flags |= ZYD_FLAG_FWLOADED; /* complete the attach process */ return zyd_complete_attach(sc); @@ -451,6 +451,9 @@ zyd_detach(device_t dev) if (!device_is_attached(dev)) return 0; + /* set a flag to indicate we're detaching. */ + sc->sc_flags |= ZYD_FLAG_DETACHING; + /* protect a race when we have listeners related with the driver. */ ifp->if_flags &= ~IFF_UP; @@ -2743,6 +2746,9 @@ zyd_scantask(void *arg) struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; + if (sc->sc_flags & ZYD_FLAG_DETACHING) + return; + ZYD_LOCK(sc); switch (sc->sc_scan_action) { diff --git a/sys/dev/usb/if_zydreg.h b/sys/dev/usb/if_zydreg.h index 4d9c8fd..bd7d197 100644 --- a/sys/dev/usb/if_zydreg.h +++ b/sys/dev/usb/if_zydreg.h @@ -1198,8 +1198,9 @@ struct zyd_softc { usbd_device_handle sc_udev; usbd_interface_handle sc_iface; int sc_flags; +#define ZYD_FLAG_FWLOADED (1 << 0) +#define ZYD_FLAG_DETACHING (1 << 1) int sc_if_flags; -#define ZD1211_FWLOADED (1 << 0) uint8_t sc_bssid[IEEE80211_ADDR_LEN]; enum ieee80211_state sc_state; |