diff options
| author | Marco Elver <elver@google.com> | 2025-12-19 16:40:13 +0100 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-01-05 16:43:33 +0100 |
| commit | e4588c25c9d122b5847b88e18b184404b6959160 (patch) | |
| tree | 00ddee9629bf524daf0bca778c0f9d1be4080dfe /include/linux/compiler-context-analysis.h | |
| parent | 5b63d0ae94ccfd64dcbdb693d88eb3650eb3c64c (diff) | |
| download | linux-next-e4588c25c9d122b5847b88e18b184404b6959160.tar.gz linux-next-e4588c25c9d122b5847b88e18b184404b6959160.zip | |
compiler-context-analysis: Remove __cond_lock() function-like helper
As discussed in [1], removing __cond_lock() will improve the readability
of trylock code. Now that Sparse context tracking support has been
removed, we can also remove __cond_lock().
Change existing APIs to either drop __cond_lock() completely, or make
use of the __cond_acquires() function attribute instead.
In particular, spinlock and rwlock implementations required switching
over to inline helpers rather than statement-expressions for their
trylock_* variants.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/all/20250207082832.GU7145@noisy.programming.kicks-ass.net/ [1]
Link: https://patch.msgid.link/20251219154418.3592607-25-elver@google.com
Diffstat (limited to 'include/linux/compiler-context-analysis.h')
| -rw-r--r-- | include/linux/compiler-context-analysis.h | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/include/linux/compiler-context-analysis.h b/include/linux/compiler-context-analysis.h index cb728822343f..4f7559d7ae91 100644 --- a/include/linux/compiler-context-analysis.h +++ b/include/linux/compiler-context-analysis.h @@ -342,24 +342,6 @@ static inline void _context_unsafe_alias(void **p) { } #define __release(x) __release_ctx_lock(x) /** - * __cond_lock() - function that conditionally acquires a context lock - * exclusively - * @x: context lock instance pinter - * @c: boolean expression - * - * Return: result of @c - * - * No-op function that conditionally acquires context lock instance @x - * exclusively, if the boolean expression @c is true. The result of @c is the - * return value; for example: - * - * .. code-block:: c - * - * #define spin_trylock(l) __cond_lock(&lock, _spin_trylock(&lock)) - */ -#define __cond_lock(x, c) __try_acquire_ctx_lock(x, c) - -/** * __must_hold_shared() - function attribute, caller must hold shared context lock * * Function attribute declaring that the caller must hold the given context @@ -418,19 +400,6 @@ static inline void _context_unsafe_alias(void **p) { } #define __release_shared(x) __release_shared_ctx_lock(x) /** - * __cond_lock_shared() - function that conditionally acquires a context lock shared - * @x: context lock instance pinter - * @c: boolean expression - * - * Return: result of @c - * - * No-op function that conditionally acquires context lock instance @x with - * shared access, if the boolean expression @c is true. The result of @c is the - * return value. - */ -#define __cond_lock_shared(x, c) __try_acquire_shared_ctx_lock(x, c) - -/** * __acquire_ret() - helper to acquire context lock of return value * @call: call expression * @ret_expr: acquire expression that uses __ret |
