Merge tag 'acpi-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[linux-2.6-microblaze.git] / include / linux / lockdep.h
index 7b7ebf2..5cf3878 100644 (file)
@@ -155,7 +155,7 @@ extern void lockdep_set_selftest_task(struct task_struct *task);
 extern void lockdep_init_task(struct task_struct *task);
 
 /*
- * Split the recrursion counter in two to readily detect 'off' vs recursion.
+ * Split the recursion counter in two to readily detect 'off' vs recursion.
  */
 #define LOCKDEP_RECURSION_BITS 16
 #define LOCKDEP_OFF            (1U << LOCKDEP_RECURSION_BITS)
@@ -268,6 +268,11 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
 
 extern void lock_release(struct lockdep_map *lock, unsigned long ip);
 
+/* lock_is_held_type() returns */
+#define LOCK_STATE_UNKNOWN     -1
+#define LOCK_STATE_NOT_HELD    0
+#define LOCK_STATE_HELD                1
+
 /*
  * Same "read" as for lock_acquire(), except -1 means any.
  */
@@ -301,8 +306,14 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie);
 
 #define lockdep_depth(tsk)     (debug_locks ? (tsk)->lockdep_depth : 0)
 
-#define lockdep_assert_held(l) do {                            \
-               WARN_ON(debug_locks && !lockdep_is_held(l));    \
+#define lockdep_assert_held(l) do {                                    \
+               WARN_ON(debug_locks &&                                  \
+                       lockdep_is_held(l) == LOCK_STATE_NOT_HELD);     \
+       } while (0)
+
+#define lockdep_assert_not_held(l)     do {                            \
+               WARN_ON(debug_locks &&                                  \
+                       lockdep_is_held(l) == LOCK_STATE_HELD);         \
        } while (0)
 
 #define lockdep_assert_held_write(l)   do {                    \
@@ -317,6 +328,10 @@ extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie);
                WARN_ON_ONCE(debug_locks && !lockdep_is_held(l));       \
        } while (0)
 
+#define lockdep_assert_none_held_once()        do {                            \
+               WARN_ON_ONCE(debug_locks && current->lockdep_depth);    \
+       } while (0)
+
 #define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
 
 #define lockdep_pin_lock(l)    lock_pin_lock(&(l)->dep_map)
@@ -393,9 +408,11 @@ extern int lockdep_is_held(const void *);
 #define lockdep_is_held_type(l, r)             (1)
 
 #define lockdep_assert_held(l)                 do { (void)(l); } while (0)
-#define lockdep_assert_held_write(l)   do { (void)(l); } while (0)
+#define lockdep_assert_not_held(l)             do { (void)(l); } while (0)
+#define lockdep_assert_held_write(l)           do { (void)(l); } while (0)
 #define lockdep_assert_held_read(l)            do { (void)(l); } while (0)
 #define lockdep_assert_held_once(l)            do { (void)(l); } while (0)
+#define lockdep_assert_none_held_once()        do { } while (0)
 
 #define lockdep_recursing(tsk)                 (0)