-/* $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>
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 *);
{
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;
}
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)
{