Skip to content

Commit b1f01f9

Browse files
Sebastian Andrzej SiewiorKAGA-KOKO
authored andcommitted
locking/rt: Remove one __cond_lock() in RT's spin_trylock_irqsave()
spin_trylock_irqsave() has a __cond_lock() wrapper which points to __spin_trylock_irqsave(). The function then invokes spin_trylock() which has another __cond_lock() finally pointing to rt_spin_trylock(). The compiler has no problem to parse this but sparse does not recognise that users of spin_trylock_irqsave() acquire a conditional lock and complains. Remove one layer of __cond_lock() so that sparse recognises conditional locking. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 52e0874 commit b1f01f9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

include/linux/spinlock_rt.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static __always_inline void spin_unlock_irqrestore(spinlock_t *lock,
132132
#define spin_trylock_irq(lock) \
133133
__cond_lock(lock, rt_spin_trylock(lock))
134134

135-
#define __spin_trylock_irqsave(lock, flags) \
135+
#define spin_trylock_irqsave(lock, flags) \
136136
({ \
137137
int __locked; \
138138
\
@@ -142,9 +142,6 @@ static __always_inline void spin_unlock_irqrestore(spinlock_t *lock,
142142
__locked; \
143143
})
144144

145-
#define spin_trylock_irqsave(lock, flags) \
146-
__cond_lock(lock, __spin_trylock_irqsave(lock, flags))
147-
148145
#define spin_is_contended(lock) (((void)(lock), 0))
149146

150147
static inline int spin_is_locked(spinlock_t *lock)

0 commit comments

Comments
 (0)