From nobody Sun Feb 8 12:19:05 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D33AF3570AE for ; Mon, 19 Jan 2026 09:40:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768815651; cv=none; b=dafIyr9/SQdBC+hcEX1EUWSkbqoIsvs/DsPJPfL65m89KCGHhNEfJhfFJcUbJ1ejkeB0/DyaG/IC9rxRFfW1jJQKK25p+z7Oj0C2ni7SgosDmInG9goSciEC5ildi8FvuBD1dM695bdK2mLv3YKEheHoomnlxqLJWoSWY37Q0pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768815651; c=relaxed/simple; bh=KgBNkhyWNQ2k0IPDloVTMBnOWkgGfX49s05GA2EIxpQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NHIFyu+ZHI8l2KjgZb+bKAJCDXUNtzy5b8irLRIDawJM9i2ZUSd/ZNAGamfDsNewXQH93Y+GMMljPjQ+5SUAEC5+QracIYzGZf2B8mvJrvop1HbPHTswmdFNE4Dv4fxx8fJIFkCpnHLBFSYfNr5cov39ps1FgFIvaB+nJnXp3zo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--elver.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=bm81DMjF; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--elver.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bm81DMjF" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-47d3ba3a49cso43825485e9.2 for ; Mon, 19 Jan 2026 01:40:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768815648; x=1769420448; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FVzjIjtVdiVPjpEIkbADcVmmkIUg4nu9DkgIt9tpdDQ=; b=bm81DMjFfdktpqHH9slPweWJXUfFPptm5Ji2niPZAjiAzpdizmvIaHTJ08W+JlSqUx puWfEACgRHBpwKfJldW9LTqVn2fSr7Br7fQxDMgTVPmeJAPWz6kxogQo3gEK81ZyT0LA vOJyFMQjL/TYcQqymCTP0/BlmOwIyTwC8X6jTKM7H2mFWJJEmpDjyF+WeuwueVegZIo9 h9ZjKE1uOhveVyDK5uLNqCN9GEjEzLeFwNJAV7lzLClOz2etstR8RG7K7b0wLCxxqALF +wqmRO1sovhlMxbgAOLaSj6rir+Eqvdw3NQVOs6UpAhcuGXAv1g9M3929XmuDA0/msRS ND8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768815648; x=1769420448; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FVzjIjtVdiVPjpEIkbADcVmmkIUg4nu9DkgIt9tpdDQ=; b=PKGRIdXZxk3xIQgC8y9x+J41eUyUL+bC5fT+35C6373w//6VKQ6PmWmVdn0ESqxbkx 0rEx9qgQ8WoG7upsLmjkMn/XY9TG86DMuECqrTEGBfuepR++1qoDhHVtl1VNZxJmCLiX z8L+HTqhTuGR23AfUO+pe4QGQmHJW37zcKHfkWKV8sfLUMicGQWcJdXHSYfdO4iAtHLH eMIOFr30EtHEXNAQHMlBVGnc0tQeNa4ejXfNrtNEFxHr9Jh1cUSGB6oxaR5TaT5UJVn4 rSuBypNWMk/RPRfwii9wYEdULYvG5gM1d6GoaGzFQkblEtdTDXG4L7kk5DLnQMorjVXo kyGw== X-Forwarded-Encrypted: i=1; AJvYcCVJY8Ef+6YP8zToHV+Ea8kNtL8AhVeA6rrHE4RwvRRp3AC7RyyTpYqA+Fy5laI0uDt7fyhQAvn6ksNO9BA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9CSytc8locPrO3fo3FgSTrKQNokbQCMzyf7pKxPJYQtc+4k91 ntxajQz9UhW9i5tJYMM0vY5+dnarg7PABPEfyk/X8Cd6ZHXtIX9hTUreUpzn0qXqVE0JkjIk4wv FNw== X-Received: from wmaz14.prod.google.com ([2002:a05:600c:6d8e:b0:477:a1f9:138c]) (user=elver job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4e89:b0:475:dd89:acb with SMTP id 5b1f17b1804b1-4801eb035ecmr125513305e9.22.1768815648401; Mon, 19 Jan 2026 01:40:48 -0800 (PST) Date: Mon, 19 Jan 2026 10:05:51 +0100 In-Reply-To: <20260119094029.1344361-1-elver@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260119094029.1344361-1-elver@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260119094029.1344361-2-elver@google.com> Subject: [PATCH tip/locking/core 1/6] cleanup: Make __DEFINE_LOCK_GUARD handle commas in initializers From: Marco Elver To: elver@google.com, Peter Zijlstra , Ingo Molnar Cc: Thomas Gleixner , Will Deacon , Boqun Feng , Waiman Long , Christoph Hellwig , Steven Rostedt , Bart Van Assche , kasan-dev@googlegroups.com, llvm@lists.linux.dev, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Initialization macros can expand to structure initializers containing commas, which when used as a "lock" function resulted in errors such as: >> include/linux/spinlock.h:582:56: error: too many arguments provided to f= unction-like macro invocation 582 | DEFINE_LOCK_GUARD_1(raw_spinlock_init, raw_spinlock_t, raw_spin_= lock_init(_T->lock), /* */) | ^ include/linux/spinlock.h:113:17: note: expanded from macro 'raw_spin_loc= k_init' 113 | do { *(lock) =3D __RAW_SPIN_LOCK_UNLOCKED(lock); } while= (0) | ^ include/linux/spinlock_types_raw.h:70:19: note: expanded from macro '__R= AW_SPIN_LOCK_UNLOCKED' 70 | (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname) | ^ include/linux/spinlock_types_raw.h:67:34: note: expanded from macro '__R= AW_SPIN_LOCK_INITIALIZER' 67 | RAW_SPIN_DEP_MAP_INIT(lockname) } | ^ include/linux/cleanup.h:496:9: note: macro '__DEFINE_LOCK_GUARD_1' defin= ed here 496 | #define __DEFINE_LOCK_GUARD_1(_name, _type, _lock) = \ | ^ include/linux/spinlock.h:582:1: note: parentheses are required around ma= cro argument containing braced initializer list 582 | DEFINE_LOCK_GUARD_1(raw_spinlock_init, raw_spinlock_t, raw_spin_= lock_init(_T->lock), /* */) | ^ | ( include/linux/cleanup.h:558:60: note: expanded from macro 'DEFINE_LOCK_G= UARD_1' 558 | __DEFINE_UNLOCK_GUARD(_name, _type, _unlock, __VA_ARGS__) = \ | = ^ Make __DEFINE_LOCK_GUARD_0 and __DEFINE_LOCK_GUARD_1 variadic so that __VA_ARGS__ captures everything. Reported-by: kernel test robot Signed-off-by: Marco Elver --- include/linux/cleanup.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/cleanup.h b/include/linux/cleanup.h index ee6df68c2177..dbc4162921e9 100644 --- a/include/linux/cleanup.h +++ b/include/linux/cleanup.h @@ -493,22 +493,22 @@ static __always_inline void class_##_name##_destructo= r(class_##_name##_t *_T) \ \ __DEFINE_GUARD_LOCK_PTR(_name, &_T->lock) =20 -#define __DEFINE_LOCK_GUARD_1(_name, _type, _lock) \ +#define __DEFINE_LOCK_GUARD_1(_name, _type, ...) \ static __always_inline class_##_name##_t class_##_name##_constructor(_type= *l) \ __no_context_analysis \ { \ class_##_name##_t _t =3D { .lock =3D l }, *_T =3D &_t; \ - _lock; \ + __VA_ARGS__; \ return _t; \ } =20 -#define __DEFINE_LOCK_GUARD_0(_name, _lock) \ +#define __DEFINE_LOCK_GUARD_0(_name, ...) \ static __always_inline class_##_name##_t class_##_name##_constructor(void)= \ __no_context_analysis \ { \ class_##_name##_t _t =3D { .lock =3D (void*)1 }, \ *_T __maybe_unused =3D &_t; \ - _lock; \ + __VA_ARGS__; \ return _t; \ } =20 --=20 2.52.0.457.g6b5491de43-goog