Re: [PATCH 4/4] arm64: kernel: Fix style in io.c macro

From: Mark Rutland

Date: Mon Mar 02 2026 - 13:08:39 EST


On Mon, Mar 02, 2026 at 03:45:16PM +0000, Josh Law wrote:
> 2 Mar 2026 14:51:19 Mark Rutland <mark.rutland@xxxxxxx>:
>
> > On Sun, Mar 01, 2026 at 12:34:07AM +0000, Josh Law wrote:
> >> Signed-off-by: Josh Law <objecting@xxxxxxxxxxxxx>
> >> ---
> >> arch/arm64/kernel/io.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/arch/arm64/kernel/io.c b/arch/arm64/kernel/io.c
> >> index fe86ada23c7d..ce27fa5d2e37 100644
> >> --- a/arch/arm64/kernel/io.c
> >> +++ b/arch/arm64/kernel/io.c
> >> @@ -17,10 +17,10 @@
> >> #define memcpy_toio_aligned(to, from, count, bits)                        \
> >>     ({                                                                \
> >>         volatile u##bits __iomem *_to = to;                       \
> >> -       const u##bits *_from = from;                              \
> >> +       const u##bits * _from = from;                             \
> >>         size_t _count = count;                                    \
> >> -       const u##bits *_end_from = _from + ALIGN_DOWN(_count, 8); \
> >> -                                                                          \
> >> +       const u##bits * _end_from = _from + ALIGN_DOWN(_count, 8);\
> >> +\
> >
> > There is no style violation here. There's no need to add a space between
> > '*' and the variable name.
> >
> > Mark.
>
> I used checkpatch.pl... it detected that

So? Tools can be wrong.

In general, checkpatch.pl shouldn't be applied to existing files to find
issues, since there are many deliberate violations, and cases it cannot
parse correctly.

I checked out v7.0-rc2, and ran:

./scripts/checkpatch.pl -f arch/arm64/kernel/io.c

... and the warning you see seems to be:

| ERROR: need consistent spacing around '*' (ctx:WxV)
| #20: FILE: arch/arm64/kernel/io.c:20:
| + const u##bits *_from = from; \
| ^

>From a quick scan of checkpatch.pl, that's because it has mis-parsed
this as a binary operator, where we *do* want consistent space around
the '*'.

For types that's not the case, e.g.

| [mark@lakrids:~/src/linux]% cat test.c
| int *foo = 1;
|
| int * bar = 1;
| [mark@lakrids:~/src/linux]% ./scripts/checkpatch.pl -f test.c
| WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
| #1: FILE: test.c:1:
| +int *foo = 1;
|
| ERROR: "foo * bar" should be "foo *bar"
| #3: FILE: test.c:3:
| +int * bar = 1;

Mark.