Konstantin Demin
c3d09a3e94
imported from https://salsa.debian.org/kernel-team/linux.git commit 9d5cc9d9d6501d7f1dd7e194d4b245bd0b6c6a22 version 6.11.4-1
45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
Date: Mon, 12 Aug 2024 12:39:03 +0200
|
|
Subject: [PATCH 2/4] locking/rt: Remove one __cond_lock() in RT's
|
|
spin_trylock_irqsave()
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.11/older/patches-6.11-rt7.tar.xz
|
|
|
|
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.
|
|
|
|
Link: https://lore.kernel.org/r/20240812104200.2239232-3-bigeasy@linutronix.de
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
---
|
|
include/linux/spinlock_rt.h | 5 +----
|
|
1 file changed, 1 insertion(+), 4 deletions(-)
|
|
|
|
--- a/include/linux/spinlock_rt.h
|
|
+++ b/include/linux/spinlock_rt.h
|
|
@@ -132,7 +132,7 @@ static __always_inline void spin_unlock_
|
|
#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_
|
|
__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)
|