Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux Implement lockdep assert...



details:   https://anonhg.NetBSD.org/src/rev/ec8a2a0ba257
branches:  trunk
changeset: 1027827:ec8a2a0ba257
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 00:50:18 2021 +0000

description:
Implement lockdep assertions. Add lockdep_assert_held_once.

diffstat:

 sys/external/bsd/drm2/include/linux/mutex.h |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (37 lines):

diff -r 1b9ca6b97dc3 -r ec8a2a0ba257 sys/external/bsd/drm2/include/linux/mutex.h
--- a/sys/external/bsd/drm2/include/linux/mutex.h       Sun Dec 19 00:50:11 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/mutex.h       Sun Dec 19 00:50:18 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mutex.h,v 1.13 2021/12/19 00:47:24 riastradh Exp $     */
+/*     $NetBSD: mutex.h,v 1.14 2021/12/19 00:50:18 riastradh Exp $     */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,9 +41,8 @@
 #include <linux/list.h>
 #include <linux/spinlock.h>
 
-#define        __acquires(lock)                        /* XXX lockdep stuff */
-#define        __releases(lock)                        /* XXX lockdep stuff */
-#define might_lock(lock) do {} while(0)        /* XXX lockdep stuff */
+#define        __acquires(lock)        /* XXX lockdep annotation */
+#define        __releases(lock)        /* XXX lockdep annotation */
 
 struct mutex {
        kmutex_t mtx_lock;
@@ -113,9 +112,12 @@
        mutex_lock(mutex);
 }
 
-#define        __lockdep_used          __unused
-#define        lockdep_assert_held(m)  do {} while (0)
-#define        lockdep_is_held(m)      1
+#define        __lockdep_used                  __diagused
+#define        lockdep_assert_held(m)          KASSERT(mutex_owned(&(m)->mtx_lock))
+#define        lockdep_assert_held_once(m)     KASSERT(mutex_owned(&(m)->mtx_lock))
+#define        lockdep_is_held(m)              mutex_owned(&(m)->mtx_lock)
+
+#define        might_lock(m)                   KDASSERT(mutex_ownable(&(m)->mtx_lock))
 
 #define        SINGLE_DEPTH_NESTING    0
 



Home | Main Index | Thread Index | Old Index