diff options
| author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2024-08-12 13:39:03 +0300 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2024-10-24 12:27:01 +0300 |
| commit | b1f01f9e54b1aaadb6740f86017e8fabdee77fe2 (patch) | |
| tree | 270ae9789677e389132de5f7e5d67eb6e34b8549 /include | |
| parent | 52e0874fc16bd26e9ea1871e30ffb2c6dff187cf (diff) | |
| download | linux-b1f01f9e54b1aaadb6740f86017e8fabdee77fe2.tar.xz | |
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 <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20240812104200.2239232-3-bigeasy@linutronix.de
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/spinlock_rt.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/include/linux/spinlock_rt.h b/include/linux/spinlock_rt.h index babc3e028779..f9f14e135be7 100644 --- a/include/linux/spinlock_rt.h +++ b/include/linux/spinlock_rt.h @@ -132,7 +132,7 @@ static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, #define spin_trylock_irq(lock) \ __cond_lock(lock, rt_spin_trylock(lock)) -#define __spin_trylock_irqsave(lock, flags) \ +#define spin_trylock_irqsave(lock, flags) \ ({ \ int __locked; \ \ @@ -142,9 +142,6 @@ static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, __locked; \ }) -#define spin_trylock_irqsave(lock, flags) \ - __cond_lock(lock, __spin_trylock_irqsave(lock, flags)) - #define spin_is_contended(lock) (((void)(lock), 0)) static inline int spin_is_locked(spinlock_t *lock) |
