Re: [PATCH] staging: fbtft: fbtft-bus: replace function-defining macro with concrete functions
From: Andy Shevchenko
Date: Fri Apr 24 2026 - 05:38:56 EST
On Fri, Apr 24, 2026 at 11:28:18AM +0200, Alexandru Hossu wrote:
> The define_fbtft_write_reg macro defines full function bodies including
> a goto statement and a trailing semicolon on EXPORT_SYMBOL(), which
> violates kernel coding style (checkpatch reports 2 ERRORs, 2 WARNINGs,
> and 5 CHECKs).
OK.
> Replace it with three concrete C functions that are semantically
> identical to the macro expansions:
> - fbtft_write_reg8_bus8 (u8 buffer, u8 data)
> - fbtft_write_reg16_bus8 (__be16 buffer, u16 data, cpu_to_be16)
> - fbtft_write_reg16_bus16 (u16 buffer, u16 data)
>
> The function declarations in fbtft.h are already present and unchanged.
I'm not sure this patch improves the code. What I see it's harder to follow.
NAK.
You can consider different approach(es), using _Generic() or so, but I forecast
that none of them will be better than the current code.
You also can address just a small chunk of that, exempli gratia, moving out
EXPORT_*() along with some wrappers leaving the main body of the macro
untouched. This might be a compromise. Dunno. If Greg has no objections, you
can try it out.
--
With Best Regards,
Andy Shevchenko