[tip: locking/core] ww-mutex: Fix the ww_acquire_ctx function annotations

From: tip-bot2 for Bart Van Assche

Date: Sat Feb 28 2026 - 05:57:20 EST


The following commit has been merged into the locking/core branch of tip:

Commit-ID: 3dcef70e41ab13483803c536ddea8d5f1803ee25
Gitweb: https://git.kernel.org/tip/3dcef70e41ab13483803c536ddea8d5f1803ee25
Author: Bart Van Assche <bvanassche@xxxxxxx>
AuthorDate: Wed, 25 Feb 2026 10:32:43 -08:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Fri, 27 Feb 2026 16:40:20 +01:00

ww-mutex: Fix the ww_acquire_ctx function annotations

The ww_acquire_done() call is optional. Reflect this in the annotations of
ww_acquire_done().

Fixes: 47907461e4f6 ("locking/ww_mutex: Support Clang's context analysis")
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Acked-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
Acked-by: Marco Elver <elver@xxxxxxxxxx>
Link: https://patch.msgid.link/20260225183244.4035378-4-bvanassche@xxxxxxx
---
include/linux/ww_mutex.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
index 85b1fff..0c95ead 100644
--- a/include/linux/ww_mutex.h
+++ b/include/linux/ww_mutex.h
@@ -181,7 +181,7 @@ static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
* data structures.
*/
static inline void ww_acquire_done(struct ww_acquire_ctx *ctx)
- __releases(ctx) __acquires_shared(ctx) __no_context_analysis
+ __must_hold(ctx)
{
#ifdef DEBUG_WW_MUTEXES
lockdep_assert_held(ctx);
@@ -199,7 +199,7 @@ static inline void ww_acquire_done(struct ww_acquire_ctx *ctx)
* mutexes have been released with ww_mutex_unlock.
*/
static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
- __releases_shared(ctx) __no_context_analysis
+ __releases(ctx) __no_context_analysis
{
#ifdef CONFIG_DEBUG_LOCK_ALLOC
mutex_release(&ctx->first_lock_dep_map, _THIS_IP_);