* [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c
@ 2026-04-12 17:21 Baker
2026-04-12 17:21 ` [PATCH] staging: fbtft: replace empty macro args with identity converter Baker
2026-04-13 8:56 ` Claude review: staging: fbtft: fix coding style issue in fbtft-bus.c Claude Code Review Bot
0 siblings, 2 replies; 5+ messages in thread
From: Baker @ 2026-04-12 17:21 UTC (permalink / raw)
To: andy, gregkh; +Cc: dri-devel, linux-fbdev, linux-staging, linux-kernel, Baker
Remove trailing space and comma before closing parenthesis ')' in
define_fbtft_write_reg macro as reported by checkpatch.pl.
Signed-off-by: Baker <mzndmzn@gmail.com>
---
drivers/staging/fbtft/fbtft-bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
index 30e436ff19e4..409770891c54 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -62,9 +62,9 @@ out: \
} \
EXPORT_SYMBOL(func);
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8)
define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16)
void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
{
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] staging: fbtft: replace empty macro args with identity converter
2026-04-12 17:21 [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c Baker
@ 2026-04-12 17:21 ` Baker
2026-04-13 8:56 ` Claude review: " Claude Code Review Bot
2026-04-13 8:56 ` Claude Code Review Bot
2026-04-13 8:56 ` Claude review: staging: fbtft: fix coding style issue in fbtft-bus.c Claude Code Review Bot
1 sibling, 2 replies; 5+ messages in thread
From: Baker @ 2026-04-12 17:21 UTC (permalink / raw)
To: andy, gregkh; +Cc: dri-devel, linux-fbdev, linux-staging, linux-kernel, Baker
The define_fbtft_write_reg macro calls 'modifier' as a function.
Passing an empty token as modifier is undefined behavior in C for
fixed-arity macros. Introduce fbtft_no_conv() as an identity
function to replace the empty args in the no-conversion cases.
Signed-off-by: Baker <mzndmzn@gmail.com>
---
drivers/staging/fbtft/fbtft-bus.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
index 30e436ff19e4..8ce263f68ed2 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -11,6 +11,8 @@
*
*****************************************************************************/
+#define fbtft_no_conv(x) (x)
+
#define define_fbtft_write_reg(func, buffer_type, data_type, modifier) \
void func(struct fbtft_par *par, int len, ...) \
{ \
@@ -62,9 +64,9 @@ out: \
} \
EXPORT_SYMBOL(func);
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8)
define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16)
void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
{
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Claude review: staging: fbtft: replace empty macro args with identity converter
2026-04-12 17:21 ` [PATCH] staging: fbtft: replace empty macro args with identity converter Baker
@ 2026-04-13 8:56 ` Claude Code Review Bot
2026-04-13 8:56 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-13 8:56 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: staging: fbtft: replace empty macro args with identity converter
Author: Baker <mzndmzn@gmail.com>
Patches: 2
Reviewed: 2026-04-13T18:56:20.957579
---
This mbox contains two standalone `[PATCH]` submissions (not a numbered series) from the same author, both modifying the same file and the same lines. The second patch (Message-ID `2817-2`) replies to the first (`2817-1`), suggesting it is intended as a revision or improvement. **Both patches are broken and will fail to compile**, because they reduce the invocation of a 4-parameter macro to only 3 arguments without updating the macro definition. Additionally, the stated premise — that empty macro arguments are undefined behavior — is incorrect under C99 and later standards, which the kernel uses.
**Neither patch should be applied as-is.**
---
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: staging: fbtft: replace empty macro args with identity converter
2026-04-12 17:21 ` [PATCH] staging: fbtft: replace empty macro args with identity converter Baker
2026-04-13 8:56 ` Claude review: " Claude Code Review Bot
@ 2026-04-13 8:56 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-13 8:56 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Commit message:**
> Remove trailing space and comma before closing parenthesis ')' in define_fbtft_write_reg macro as reported by checkpatch.pl.
**Critical bug — will not compile.** The macro `define_fbtft_write_reg` is defined with 4 parameters:
```c
#define define_fbtft_write_reg(func, buffer_type, data_type, modifier)
```
But the patch changes the invocations from 4 arguments (with an empty 4th) to 3:
```c
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8)
```
Calling a fixed-arity 4-parameter macro with only 3 arguments is a hard error from the preprocessor. GCC will emit: `error: macro "define_fbtft_write_reg" requires 4 arguments, but only 3 given`.
The existing code with the empty 4th argument (`, )`) is actually well-defined in C99 and GNU C (which the kernel uses via `-std=gnu11`). An empty macro argument is a valid "placemarker" preprocessing token per C99 §6.10.3. When `modifier` is empty, `modifier((data_type)va_arg(args, unsigned int))` expands to `((data_type)va_arg(args, unsigned int))` — a correctly parenthesized identity operation. The checkpatch warning is cosmetic and the existing code is correct.
**Verdict:** NAK. This patch introduces a build failure.
---
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Claude review: staging: fbtft: fix coding style issue in fbtft-bus.c
2026-04-12 17:21 [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c Baker
2026-04-12 17:21 ` [PATCH] staging: fbtft: replace empty macro args with identity converter Baker
@ 2026-04-13 8:56 ` Claude Code Review Bot
1 sibling, 0 replies; 5+ messages in thread
From: Claude Code Review Bot @ 2026-04-13 8:56 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Commit message:**
> The define_fbtft_write_reg macro calls 'modifier' as a function. Passing an empty token as modifier is undefined behavior in C for fixed-arity macros. Introduce fbtft_no_conv() as an identity function to replace the empty args in the no-conversion cases.
This patch appears to be a v2/improvement over Patch 1, attempting to address the underlying concern properly by introducing an identity macro:
```c
+#define fbtft_no_conv(x) (x)
```
**However, the patch has two bugs:**
1. **Same compilation failure as Patch 1.** The invocations are still changed to 3 arguments:
```c
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8)
```
The `fbtft_no_conv` macro is defined but never actually passed as the 4th argument. The correct change should have been:
```c
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, fbtft_no_conv)
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, fbtft_no_conv)
```
2. **Incorrect premise.** The commit message claims "Passing an empty token as modifier is undefined behavior in C for fixed-arity macros." This is not true under C99+. Empty macro arguments are explicitly permitted by the C99 standard and later, and the Linux kernel builds with GNU C11. The existing code is well-defined.
**If the author wants to improve clarity** (replacing the empty argument with a named identity macro is arguably more readable, even if the empty arg is valid), the corrected version of this patch would be:
```c
#define fbtft_no_conv(x) (x)
...
define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, fbtft_no_conv)
define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, fbtft_no_conv)
```
The commit message should also be updated to remove the UB claim and instead frame it as a readability/clarity improvement.
**Verdict:** NAK. Introduces a build failure and adds dead code (`fbtft_no_conv` defined but unused). The approach has merit if implemented correctly, but as submitted this does not compile.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-13 8:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-12 17:21 [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c Baker
2026-04-12 17:21 ` [PATCH] staging: fbtft: replace empty macro args with identity converter Baker
2026-04-13 8:56 ` Claude review: " Claude Code Review Bot
2026-04-13 8:56 ` Claude Code Review Bot
2026-04-13 8:56 ` Claude review: staging: fbtft: fix coding style issue in fbtft-bus.c Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox