From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,joe@perches.com,apw@canonical.com,
ptosi@google.com,akpm@linux-foundation.org
Subject: + checkpatch-fix-bad-complex_macro-on-asm-volatile.patch added to mm-nonmm-unstable branch
Date: Sun, 08 Nov 2026 21:52:19 -0800 [thread overview]
Message-ID: <20261109055219.B18A91F0089F@smtp.kernel.org> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3746 bytes --]
The patch titled
Subject: checkpatch: fix bad COMPLEX_MACRO on asm volatile
has been added to the -mm mm-nonmm-unstable branch. Its filename is
checkpatch-fix-bad-complex_macro-on-asm-volatile.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/checkpatch-fix-bad-complex_macro-on-asm-volatile.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Pierre-Clément Tosi <ptosi@google.com>
Subject: checkpatch: fix bad COMPLEX_MACRO on asm volatile
Date: Sat, 07 Nov 2026 15:57:02 +0100
Commit 42e152931deb ("checkpatch: exclude asm volatile from complex macro
check") added a substitution converting "asm volatile" into "asm_volatile"
so that macros expanding to an asm volatile statement would be treated
like a single function call and excluded from the COMPLEX_MACRO error
("Macros with complex values should be enclosed in parentheses").
However, that substitution was placed after the loop that flattens
parenthesized expressions into "1u" (originally "1"). For a macro without
whitespace between "volatile" and "(", such as:
#define foo(x) asm volatile("..." : : "r" (x))
flattening the parenthesized argument list first turns the statement into
"asm volatile1u". Because "1u" starts with a word character, the trailing
word boundary (\b) in /\b_*asm_*\s+_*volatile_*\b/ no longer matches after
"volatile", leaving the space between "asm" and "volatile1u" intact and
causing the macro to still fail the single-lvalue check and trigger a
false-positive COMPLEX_MACRO error.
Move the "asm volatile" to "asm_volatile" substitution before the
parenthesis-flattening loop so that "asm volatile(...)" is first rewritten
to "asm_volatile(...)" and then flattened to "asm_volatile1u" as intended.
Link: https://lore.kernel.org/20261107-checkpatch-asm-complex_macro-v1-1-9a7b3c69fc28@google.com
Fixes: 42e152931deb ("checkpatch: exclude asm volatile from complex macro check")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
---
scripts/checkpatch.pl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/scripts/checkpatch.pl~checkpatch-fix-bad-complex_macro-on-asm-volatile
+++ a/scripts/checkpatch.pl
@@ -6056,6 +6056,9 @@ sub process {
$dstat =~ s/^\s*//s;
$dstat =~ s/\s*$//s;
+ # Make asm volatile uses seem like a generic function
+ $dstat =~ s/\b_*asm_*\s+_*volatile_*\b/asm_volatile/g;
+
# Flatten any parentheses and braces
while ($dstat =~ s/\([^\(\)]*\)/1u/ ||
$dstat =~ s/\{[^\{\}]*\}/1u/ ||
@@ -6069,9 +6072,6 @@ sub process {
{
}
- # Make asm volatile uses seem like a generic function
- $dstat =~ s/\b_*asm_*\s+_*volatile_*\b/asm_volatile/g;
-
my $exceptions = qr{
$Declare|
# named exceptions
_
Patches currently in -mm which might be from ptosi@google.com are
checkpatch-fix-bad-file_path_changes-on-headers.patch
checkpatch-fix-bad-complex_macro-on-asm-volatile.patch
reply other threads:[~2026-11-09 5:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261109055219.B18A91F0089F@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=mm-commits@vger.kernel.org \
--cc=ptosi@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.