]> git.baikalelectronics.ru Git - kernel.git/commitdiff
lockdep: add might_lock_nested()
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 4 Nov 2019 17:37:19 +0000 (18:37 +0100)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Thu, 7 Nov 2019 08:58:32 +0000 (09:58 +0100)
Necessary to annotate functions where we might acquire a
mutex_lock_nested() or similar. Needed by i915.

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191104173720.2696-2-daniel.vetter@ffwll.ch
include/linux/lockdep.h

index b8a835fd611b286993eb9801598065ab442ef3f4..827722c21797952c2734572ff915551d7f7bff70 100644 (file)
@@ -628,6 +628,13 @@ do {                                                                       \
        lock_acquire(&(lock)->dep_map, 0, 0, 1, 1, NULL, _THIS_IP_);    \
        lock_release(&(lock)->dep_map, 0, _THIS_IP_);                   \
 } while (0)
+# define might_lock_nested(lock, subclass)                             \
+do {                                                                   \
+       typecheck(struct lockdep_map *, &(lock)->dep_map);              \
+       lock_acquire(&(lock)->dep_map, subclass, 0, 1, 1, NULL,         \
+                    _THIS_IP_);                                        \
+       lock_release(&(lock)->dep_map, 0, _THIS_IP_);           \
+} while (0)
 
 #define lockdep_assert_irqs_enabled()  do {                            \
                WARN_ONCE(debug_locks && !current->lockdep_recursion && \
@@ -650,6 +657,7 @@ do {                                                                        \
 #else
 # define might_lock(lock) do { } while (0)
 # define might_lock_read(lock) do { } while (0)
+# define might_lock_nested(lock, subclass) do { } while (0)
 # define lockdep_assert_irqs_enabled() do { } while (0)
 # define lockdep_assert_irqs_disabled() do { } while (0)
 # define lockdep_assert_in_irq() do { } while (0)