summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-11-12 04:36:22 +0000
committerjsg <jsg@openbsd.org>2020-11-12 04:36:22 +0000
commita4a675d73f80e90e53abf3ae5ccaef843e24394a (patch)
treea2ad45701386d6ce6e63ec6472d637b4d477811e /sys
parentFix athn(4) in client mode against APs that use WPA1/TKIP as the group cipher. (diff)
downloadwireguard-openbsd-a4a675d73f80e90e53abf3ae5ccaef843e24394a.tar.xz
wireguard-openbsd-a4a675d73f80e90e53abf3ae5ccaef843e24394a.zip
use RWLOCK_INITIALIZER() in DEFINE_MUTEX()
Gives rwlocks defined this way a non-NULL rwl_name. Move ttm_pool_shrink_scan() DEFINE_MUTEX use out of function scope to fix build with WITNESS after this change and expand macro to have a better name than "lock". Found by and ok semarie@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/include/linux/mutex.h2
-rw-r--r--sys/dev/pci/drm/ttm/ttm_page_alloc.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/include/linux/mutex.h b/sys/dev/pci/drm/include/linux/mutex.h
index f396289c62b..fd65b11b46c 100644
--- a/sys/dev/pci/drm/include/linux/mutex.h
+++ b/sys/dev/pci/drm/include/linux/mutex.h
@@ -8,7 +8,7 @@
#include <linux/list.h>
#include <linux/spinlock_types.h>
-#define DEFINE_MUTEX(x) struct rwlock x
+#define DEFINE_MUTEX(x) struct rwlock x = RWLOCK_INITIALIZER(#x)
#define mutex_lock_interruptible_nested(rwl, subc) \
mutex_lock_interruptible(rwl)
diff --git a/sys/dev/pci/drm/ttm/ttm_page_alloc.c b/sys/dev/pci/drm/ttm/ttm_page_alloc.c
index bb5fac81dcc..71b63cca1e1 100644
--- a/sys/dev/pci/drm/ttm/ttm_page_alloc.c
+++ b/sys/dev/pci/drm/ttm/ttm_page_alloc.c
@@ -379,6 +379,7 @@ out:
return nr_free;
}
+static struct rwlock lock = RWLOCK_INITIALIZER("ttmshrink");
/**
* Callback for mm to request pool to reduce number of page held.
*
@@ -389,7 +390,6 @@ out:
static unsigned long
ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
{
- static DEFINE_MUTEX(lock);
static unsigned start_pool;
unsigned i;
unsigned pool_offset;