Skip to content

Commit 212b0f0

Browse files
Alexei Starovoitovtehcaster
authored andcommitted
locking/local_lock: Expose dep_map in local_trylock_t.
lockdep_is_held() macro assumes that "struct lockdep_map dep_map;" is a top level field of any lock that participates in LOCKDEP. Make it so for local_trylock_t. Reviewed-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Reviewed-by: Harry Yoo <[email protected]> Reviewed-by: Suren Baghdasaryan <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 1b237f1 commit 212b0f0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

include/linux/local_lock_internal.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ typedef struct {
1717

1818
/* local_trylock() and local_trylock_irqsave() only work with local_trylock_t */
1919
typedef struct {
20-
local_lock_t llock;
20+
#ifdef CONFIG_DEBUG_LOCK_ALLOC
21+
struct lockdep_map dep_map;
22+
struct task_struct *owner;
23+
#endif
2124
u8 acquired;
2225
} local_trylock_t;
2326

@@ -31,7 +34,7 @@ typedef struct {
3134
.owner = NULL,
3235

3336
# define LOCAL_TRYLOCK_DEBUG_INIT(lockname) \
34-
.llock = { LOCAL_LOCK_DEBUG_INIT((lockname).llock) },
37+
LOCAL_LOCK_DEBUG_INIT(lockname)
3538

3639
static inline void local_lock_acquire(local_lock_t *l)
3740
{
@@ -81,7 +84,7 @@ do { \
8184
local_lock_debug_init(lock); \
8285
} while (0)
8386

84-
#define __local_trylock_init(lock) __local_lock_init(lock.llock)
87+
#define __local_trylock_init(lock) __local_lock_init((local_lock_t *)lock)
8588

8689
#define __spinlock_nested_bh_init(lock) \
8790
do { \

0 commit comments

Comments
 (0)