* [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c
@ 2026-04-12 16:49 Baker
2026-04-13 8:59 ` Claude review: " Claude Code Review Bot
2026-04-13 8:59 ` Claude Code Review Bot
0 siblings, 2 replies; 4+ messages in thread
From: Baker @ 2026-04-12 16:49 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] 4+ messages in thread* Claude review: staging: fbtft: fix coding style issue in fbtft-bus.c
2026-04-12 16:49 [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c Baker
@ 2026-04-13 8:59 ` Claude Code Review Bot
2026-04-13 8:59 ` Claude Code Review Bot
1 sibling, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-04-13 8:59 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: staging: fbtft: fix coding style issue in fbtft-bus.c
Author: Baker <mzndmzn@gmail.com>
Patches: 1
Reviewed: 2026-04-13T18:59:36.948669
---
**NAK — This patch is incorrect and will break compilation.**
This is a single-patch "series" that attempts to fix a checkpatch.pl style warning by removing the trailing comma and empty 4th argument from two `define_fbtft_write_reg` macro invocations. However, the empty 4th argument is **intentional and functional** — it is not a style issue. Removing it changes the macro call from 4 arguments to 3, which will cause a preprocessor error since the macro is defined with exactly 4 parameters.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Claude review: staging: fbtft: fix coding style issue in fbtft-bus.c
2026-04-12 16:49 [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c Baker
2026-04-13 8:59 ` Claude review: " Claude Code Review Bot
@ 2026-04-13 8:59 ` Claude Code Review Bot
1 sibling, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-04-13 8:59 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Result: NAK — introduces a build break**
The macro `define_fbtft_write_reg` is defined at `fbtft-bus.c:14` with **4 parameters**:
```c
#define define_fbtft_write_reg(func, buffer_type, data_type, modifier)
```
The `modifier` parameter is used throughout the macro body as a function-like call, e.g. at line 42:
```c
*buf = modifier((data_type)va_arg(args, unsigned int));
```
When the 4th argument is left **empty** (as in the original code):
```c
define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
```
the preprocessor expands `modifier((data_type)va_arg(args, unsigned int))` to simply `((u8)va_arg(args, unsigned int))` — an identity operation wrapped in parentheses. This is a deliberate and well-known C preprocessor idiom for a "no-op modifier." Compare with line 66 where `cpu_to_be16` is passed as the modifier to perform byte-swapping:
```c
define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
```
The patch changes the invocations to only pass 3 arguments:
```c
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8)
```
This will produce a compilation error like:
> `error: macro "define_fbtft_write_reg" requires 4 arguments, but only 3 given`
The trailing comma before `)` is **not** a coding style issue — it is syntactically required to pass an empty 4th macro argument. checkpatch.pl's warning is a false positive in this context.
**If the author wishes to make this cleaner**, the correct approach would be to refactor the macro itself, for example by introducing a separate 3-parameter version without `modifier`, or by using variadic macros (`__VA_ARGS__`), or by defining a no-op modifier macro like `#define IDENTITY(x) (x)` and passing that instead of an empty argument. Simply dropping the argument is not valid.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 4+ 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-12 17:21 ` [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c Baker
0 siblings, 1 reply; 4+ 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] 4+ messages in thread* [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c
@ 2026-04-12 17:21 ` Baker
2026-04-13 8:56 ` Claude review: " Claude Code Review Bot
0 siblings, 1 reply; 4+ 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] 4+ 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-13 8:56 ` Claude Code Review Bot
0 siblings, 0 replies; 4+ 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] 4+ messages in thread
end of thread, other threads:[~2026-04-13 8:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-12 16:49 [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c Baker
2026-04-13 8:59 ` Claude review: " Claude Code Review Bot
2026-04-13 8:59 ` Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-04-12 17:21 [PATCH] staging: fbtft: replace empty macro args with identity converter Baker
2026-04-12 17:21 ` [PATCH] staging: fbtft: fix coding style issue in fbtft-bus.c Baker
2026-04-13 8:56 ` Claude review: " 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