diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-08-31 21:46:01 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-08-31 21:46:01 +0000 |
commit | 73556634cc03769df0f3d9fb8341b987597a0178 (patch) | |
tree | 836c2168a0ffc65faca95ea8da66109930f92513 /sys/dev/ic/bwfm.c | |
parent | 4f8bef2fef530d5e45f280c162174fb3dd6be8d1 (diff) |
Clean up the list of chips upon detach and mark us uninitialized.
Diffstat (limited to 'sys/dev/ic/bwfm.c')
-rw-r--r-- | sys/dev/ic/bwfm.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index 0c52220bd08..7428aae3b8a 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.88 2021/08/19 14:13:39 patrick Exp $ */ +/* $OpenBSD: bwfm.c,v 1.89 2021/08/31 21:46:00 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se> @@ -73,7 +73,7 @@ int bwfm_media_change(struct ifnet *); void bwfm_process_clm_blob(struct bwfm_softc *); int bwfm_chip_attach(struct bwfm_softc *); -int bwfm_chip_detach(struct bwfm_softc *, int); +void bwfm_chip_detach(struct bwfm_softc *); struct bwfm_core *bwfm_chip_get_core_idx(struct bwfm_softc *, int, int); struct bwfm_core *bwfm_chip_get_core(struct bwfm_softc *, int); struct bwfm_core *bwfm_chip_get_pmu(struct bwfm_softc *); @@ -342,10 +342,14 @@ bwfm_detach(struct bwfm_softc *sc, int flags) { struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &ic->ic_if; + task_del(sc->sc_taskq, &sc->sc_task); taskq_destroy(sc->sc_taskq); ieee80211_ifdetach(ifp); if_detach(ifp); + + bwfm_chip_detach(sc); + sc->sc_initialized = 0; return 0; } @@ -932,6 +936,17 @@ bwfm_chip_attach(struct bwfm_softc *sc) return 0; } +void +bwfm_chip_detach(struct bwfm_softc *sc) +{ + struct bwfm_core *core, *tmp; + + LIST_FOREACH_SAFE(core, &sc->sc_chip.ch_list, co_link, tmp) { + LIST_REMOVE(core, co_link); + free(core, M_DEVBUF, sizeof(*core)); + } +} + struct bwfm_core * bwfm_chip_get_core_idx(struct bwfm_softc *sc, int id, int idx) { |