Thread (6 messages) read the whole thread 6 messages, 4 authors, 2026-06-26

Re: [PATCH] staging: fbtft: use ARRAY_SIZE() in NUMARGS macro

From: Andy Shevchenko <hidden>
Date: 2026-06-24 11:31:43
Also in: dri-devel, linux-staging, lkml

On Wed, Jun 24, 2026 at 01:08:04PM +0530, Joyeta Modak wrote:
NUMARGS() computes the number of arguments by dividing the size of a
temporary int array by sizeof(int). Using the standard ARRAY_SIZE()
macro is the correct way to count array elements in the kernel, and
ARRAY_SIZE() also provides a __must_be_array() compile time check. There
are no functional changes.
...
-#define NUMARGS(...)  (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
+#define NUMARGS(...)  ARRAY_SIZE(((int[]){__VA_ARGS__}))
 
 #define write_reg(par, ...)                                            \
 	((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
What is the maximum parameters .write_register() takes in practice in the
fbtft drivers? If it's less than or equal to 15, we may use args.h instead.

-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help