git: b3ef4013a4fa - main - iwm: add lock assertion checks
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 12 Oct 2026 02:51:30 UTC
The branch main has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=b3ef4013a4fa75063930d0221a0bc50f95af0527
commit b3ef4013a4fa75063930d0221a0bc50f95af0527
Author: Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2026-10-12 02:40:54 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-10-12 02:40:54 +0000
iwm: add lock assertion checks
Add lock/unlock assertions to use in current and future code.
Differential Revision: https://reviews.freebsd.org/D60400
---
sys/dev/iwm/if_iwm.c | 4 ++++
sys/dev/iwm/if_iwmvar.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c
index 6840c6a4d00a..51a0313842d0 100644
--- a/sys/dev/iwm/if_iwm.c
+++ b/sys/dev/iwm/if_iwm.c
@@ -4892,6 +4892,8 @@ iwm_init(struct iwm_softc *sc)
{
int error;
+ IWM_LOCK_ASSERT_LOCKED(sc);
+
if (sc->sc_flags & IWM_FLAG_HW_INITED) {
return;
}
@@ -6557,6 +6559,8 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211)
device_t dev = sc->sc_dev;
int i;
+ IWM_LOCK_ASSERT_UNLOCKED(sc);
+
if (!sc->sc_attached)
return 0;
sc->sc_attached = 0;
diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h
index f31057c07b9b..af1c484e9690 100644
--- a/sys/dev/iwm/if_iwmvar.h
+++ b/sys/dev/iwm/if_iwmvar.h
@@ -566,6 +566,8 @@ struct iwm_softc {
#define IWM_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
#define IWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
#define IWM_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx)
+#define IWM_LOCK_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
+#define IWM_LOCK_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED)
static inline bool
iwm_fw_has_api(struct iwm_softc *sc, unsigned int api)