Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/net80211 Simplify ic lock structure and initializa...
details: https://anonhg.NetBSD.org/src-all/rev/f8983e7d4f0e
branches: trunk
changeset: 375273:f8983e7d4f0e
user: Martin Husemann <martin%NetBSD.org@localhost>
date: Tue Sep 20 20:26:11 2022 +0200
description:
Simplify ic lock structure and initialization, cleanup.
diffstat:
sys/net80211/ieee80211_netbsd.h | 23 +++++++----------------
1 files changed, 7 insertions(+), 16 deletions(-)
diffs (40 lines):
diff -r afc024981290 -r f8983e7d4f0e sys/net80211/ieee80211_netbsd.h
--- a/sys/net80211/ieee80211_netbsd.h Tue Sep 20 20:00:09 2022 +0200
+++ b/sys/net80211/ieee80211_netbsd.h Tue Sep 20 20:26:11 2022 +0200
@@ -175,10 +175,6 @@ struct epoch_tracker { } __unused;
#define NET_EPOCH_ENTER(E) /* */
#define NET_EPOCH_EXIT(E) /* */
-/* Coult it be this simple? NNN */
-#define if_addr_rlock(ifp) IFNET_LOCK(ifp)
-#define if_addr_runlock(ifp) IFNET_UNLOCK(ifp)
-
/* VNET defines to remove them ... NNN may need a lot of work! */
#define CURVNET_SET(x) /* */
@@ -225,18 +221,13 @@ extern const struct ieee80211_scanner me
/*
* Common state locking definitions.
*/
-typedef struct {
- char name[16]; /* e.g. "ath0_com_lock" */
- kmutex_t mtx;
-} ieee80211_com_lock_t;
-#define IEEE80211_LOCK_INIT(_ic, _name) do { \
- ieee80211_com_lock_t *cl = &(_ic)->ic_comlock; \
- snprintf(cl->name, sizeof(cl->name), "%s_com_lock", _name); \
- mutex_init(&cl->mtx, MUTEX_DEFAULT, IPL_SOFTNET); \
-} while (0)
-#define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock.mtx)
-#define IEEE80211_LOCK_DESTROY(_ic) mutex_destroy(IEEE80211_LOCK_OBJ(_ic))
-#define IEEE80211_LOCK(_ic) mutex_enter(IEEE80211_LOCK_OBJ(_ic))
+typedef kmutex_t ieee80211_com_lock_t;
+#define IEEE80211_LOCK_INIT(_ic, _name) \
+ mutex_init(&(_ic)->ic_comlock, MUTEX_DEFAULT, IPL_SOFTNET)
+#define IEEE80211_LOCK_OBJ(_ic) (&(_ic)->ic_comlock)
+#define IEEE80211_LOCK_DESTROY(_ic) mutex_obj_free(IEEE80211_LOCK_OBJ(_ic))
+#define IEEE80211_LOCK(_ic) \
+ mutex_enter(IEEE80211_LOCK_OBJ(_ic))
#define IEEE80211_UNLOCK(_ic) mutex_exit(IEEE80211_LOCK_OBJ(_ic))
#define IEEE80211_LOCK_ASSERT(_ic) \
KASSERTMSG(mutex_owned(IEEE80211_LOCK_OBJ(_ic)), "Lock is not owned")
Home |
Main Index |
Thread Index |
Old Index