2022-10-28 14:18:46

by Deepak R Varma

[permalink] [raw]
Subject: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
based computation such as sizeof(foo)/sizeof(foo[0]) for finding
number of elements in an array. Issue identified using coccicheck.

Signed-off-by: Deepak R Varma <[email protected]>
---
drivers/staging/fbtft/fbtft.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 2c2b5f1c1df3..5506a473be91 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -231,7 +231,7 @@ struct fbtft_par {
bool polarity;
};

-#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__))
--
2.34.1





2022-10-29 00:01:32

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

Hi Deepak,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url: https://github.com/intel-lab-lkp/linux/commits/Deepak-R-Varma/staging-fbtft-Use-ARRAY_SIZE-to-get-argument-count/20221028-213204
patch link: https://lore.kernel.org/r/Y1vZXUi0Bjiub8HZ%40ubunlion
patch subject: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count
config: arm-randconfig-r004-20221029
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/74374d9d2a2d6066b94d64aa44e9a1b24c854c4e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Deepak-R-Varma/staging-fbtft-Use-ARRAY_SIZE-to-get-argument-count/20221028-213204
git checkout 74374d9d2a2d6066b94d64aa44e9a1b24c854c4e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/staging/fbtft/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/staging/fbtft/fbtft-core.c:206:15: error: initializer element is not a compile-time constant
(xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF);
~~~~~~~~~~^~~~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fbtft-core.c:209:15: error: initializer element is not a compile-time constant
(ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF);
~~~~~~~~~~^~~~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fbtft-core.c:330:6: warning: variable 'count' set but not used [-Wunused-but-set-variable]
int count = 0;
^
1 warning and 2 errors generated.
--
>> drivers/staging/fbtft/fb_bd663474.c:110:26: error: initializer element is not a compile-time constant
write_reg(par, 0x0200, xs);
^~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_bd663474.c:111:26: error: initializer element is not a compile-time constant
write_reg(par, 0x0201, ys);
^~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_bd663474.c:114:36: error: initializer element is not a compile-time constant
write_reg(par, 0x0200, WIDTH - 1 - xs);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
~~~~~~~~^~~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
~~~~~~~~~~~~~~~~^~~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_bd663474.c:115:37: error: initializer element is not a compile-time constant
write_reg(par, 0x0201, HEIGHT - 1 - ys);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
~~~~~~~~^~~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
~~~~~~~~~~~~~~~~^~~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_bd663474.c:118:36: error: initializer element is not a compile-time constant
write_reg(par, 0x0200, WIDTH - 1 - ys);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
~~~~~~~~^~~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
~~~~~~~~~~~~~~~~^~~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
--
>> drivers/staging/fbtft/fb_hx8353d.c:67:26: error: initializer element is not a compile-time constant
write_reg(par, 0x2a, xs >> 8, xs & 0xff, xe >> 8, xe & 0xff);
~~~^~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_hx8353d.c:70:26: error: initializer element is not a compile-time constant
write_reg(par, 0x2b, ys >> 8, ys & 0xff, ye >> 8, ye & 0xff);
~~~^~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_hx8353d.c:92:6: error: initializer element is not a compile-time constant
mx | my | (par->bgr << 3));
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/fbtft/fb_hx8353d.c:77:12: note: expanded from macro 'mx'
#define mx BIT(6)
^
include/vdso/bits.h:7:19: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
~~~~~~~~^~~~~~~~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_hx8353d.c:96:6: error: initializer element is not a compile-time constant
my | mv | (par->bgr << 3));
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/fbtft/fb_hx8353d.c:76:12: note: expanded from macro 'my'
#define my BIT(7)
^
include/vdso/bits.h:7:19: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
~~~~~~~~^~~~~~~~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_hx8353d.c:100:15: error: initializer element is not a compile-time constant
par->bgr << 3);
~~~~~~~~~^~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
--
>> drivers/staging/fbtft/fb_hx8357d.c:135:8: error: initializer element is not a compile-time constant
xs >> 8, xs & 0xff, /* XSTART */
~~~^~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_hx8357d.c:139:8: error: initializer element is not a compile-time constant
ys >> 8, ys & 0xff, /* YSTART */
~~~^~~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
drivers/staging/fbtft/fb_hx8357d.c:174:44: error: initializer element is not a compile-time constant
write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, val);
^~~
drivers/staging/fbtft/fbtft.h:237:47: note: expanded from macro 'write_reg'
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
^~~~~~~~~~~
drivers/staging/fbtft/fbtft.h:234:44: note: expanded from macro 'NUMARGS'
#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
^~~~~~~~~~~
include/linux/kernel.h:55:75: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~
include/linux/compiler.h:232:59: note: expanded from macro '__must_be_array'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/compiler_types.h:298:63: note: expanded from macro '__same_type'
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
^
include/linux/build_bug.h:16:62: note: expanded from macro 'BUILD_BUG_ON_ZERO'
#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
^
3 errors generated.
..


vim +206 drivers/staging/fbtft/fbtft-core.c

c296d5f9957c03 Thomas Petazzoni 2014-12-31 201
ed2084360d040a Krzysztof Adamski 2015-01-22 202 static void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe,
ed2084360d040a Krzysztof Adamski 2015-01-22 203 int ye)
c296d5f9957c03 Thomas Petazzoni 2014-12-31 204 {
a79cb3901ee3e0 Priit Laes 2015-12-20 205 write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
c296d5f9957c03 Thomas Petazzoni 2014-12-31 @206 (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF);
c296d5f9957c03 Thomas Petazzoni 2014-12-31 207
a79cb3901ee3e0 Priit Laes 2015-12-20 208 write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
c296d5f9957c03 Thomas Petazzoni 2014-12-31 209 (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF);
c296d5f9957c03 Thomas Petazzoni 2014-12-31 210
a79cb3901ee3e0 Priit Laes 2015-12-20 211 write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
c296d5f9957c03 Thomas Petazzoni 2014-12-31 212 }
c296d5f9957c03 Thomas Petazzoni 2014-12-31 213

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (25.14 kB)
config (178.38 kB)
Download all attachments

2022-10-29 07:46:10

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> number of elements in an array. Issue identified using coccicheck.
>
> Signed-off-by: Deepak R Varma <[email protected]>
> ---
> drivers/staging/fbtft/fbtft.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> index 2c2b5f1c1df3..5506a473be91 100644
> --- a/drivers/staging/fbtft/fbtft.h
> +++ b/drivers/staging/fbtft/fbtft.h
> @@ -231,7 +231,7 @@ struct fbtft_par {
> bool polarity;
> };
>
> -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))

Please please please test-build your patches before sending them out.
To not do so just wastes reviewer resources :(

thanks,

greg k-h

2022-10-29 17:13:29

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Sat, Oct 29, 2022 at 09:32:50AM +0200, Greg Kroah-Hartman wrote:
> On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> > The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> > based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> > number of elements in an array. Issue identified using coccicheck.
> >
> > Signed-off-by: Deepak R Varma <[email protected]>
> > ---
> > drivers/staging/fbtft/fbtft.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> > index 2c2b5f1c1df3..5506a473be91 100644
> > --- a/drivers/staging/fbtft/fbtft.h
> > +++ b/drivers/staging/fbtft/fbtft.h
> > @@ -231,7 +231,7 @@ struct fbtft_par {
> > bool polarity;
> > };
> >
> > -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> > +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
>
> Please please please test-build your patches before sending them out.
> To not do so just wastes reviewer resources :(

Hello Greg,
I did build the .ko files by making the driver/staging/fbtft/ path. I verified
.o and .ko files were built.

I did a make clean just now and was again able to rebuild without any errors.
Please see the attached log file.

Is there something wrong with the way I am firing the build?

Thank you,
./drv

>
> thanks,
>
> greg k-h


Attachments:
(No filename) (1.39 kB)
fbtft_build.log (10.85 kB)
Download all attachments

2022-10-29 17:40:51

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count



On Sat, 29 Oct 2022, Deepak R Varma wrote:

> On Sat, Oct 29, 2022 at 09:32:50AM +0200, Greg Kroah-Hartman wrote:
> > On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> > > The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> > > based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> > > number of elements in an array. Issue identified using coccicheck.
> > >
> > > Signed-off-by: Deepak R Varma <[email protected]>
> > > ---
> > > drivers/staging/fbtft/fbtft.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> > > index 2c2b5f1c1df3..5506a473be91 100644
> > > --- a/drivers/staging/fbtft/fbtft.h
> > > +++ b/drivers/staging/fbtft/fbtft.h
> > > @@ -231,7 +231,7 @@ struct fbtft_par {
> > > bool polarity;
> > > };
> > >
> > > -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> > > +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
> >
> > Please please please test-build your patches before sending them out.
> > To not do so just wastes reviewer resources :(
>
> Hello Greg,
> I did build the .ko files by making the driver/staging/fbtft/ path. I verified
> .o and .ko files were built.
>
> I did a make clean just now and was again able to rebuild without any errors.
> Please see the attached log file.
>
> Is there something wrong with the way I am firing the build?

The change is in the definition of a macro. The compiler won't help you
in this case unless the macro is actually used in code that is compiled.
Find the uses and check for any nearby ifdefs. For file foo.c you can
also do make foo.i to see the result of reducing ifdef and expanding
macros. Then you can see if the code you changed is actually included in
the build.

julia

2022-10-31 07:39:44

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Sat, Oct 29, 2022 at 07:34:26PM +0200, Julia Lawall wrote:
>
>
> On Sat, 29 Oct 2022, Deepak R Varma wrote:
>
> > On Sat, Oct 29, 2022 at 09:32:50AM +0200, Greg Kroah-Hartman wrote:
> > > On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> > > > The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> > > > based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> > > > number of elements in an array. Issue identified using coccicheck.
> > > >
> > > > Signed-off-by: Deepak R Varma <[email protected]>
> > > > ---
> > > > drivers/staging/fbtft/fbtft.h | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> > > > index 2c2b5f1c1df3..5506a473be91 100644
> > > > --- a/drivers/staging/fbtft/fbtft.h
> > > > +++ b/drivers/staging/fbtft/fbtft.h
> > > > @@ -231,7 +231,7 @@ struct fbtft_par {
> > > > bool polarity;
> > > > };
> > > >
> > > > -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> > > > +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
> > >
> > > Please please please test-build your patches before sending them out.
> > > To not do so just wastes reviewer resources :(
> >
> > Hello Greg,
> > I did build the .ko files by making the driver/staging/fbtft/ path. I verified
> > .o and .ko files were built.
> >
> > I did a make clean just now and was again able to rebuild without any errors.
> > Please see the attached log file.
> >
> > Is there something wrong with the way I am firing the build?
>
> The change is in the definition of a macro. The compiler won't help you
> in this case unless the macro is actually used in code that is compiled.
> Find the uses and check for any nearby ifdefs. For file foo.c you can
> also do make foo.i to see the result of reducing ifdef and expanding
> macros. Then you can see if the code you changed is actually included in
> the build.

Okay. This is helpful. I understand. Looking into the file where the macro
expansion is reported to be failed.

Thank you,
./drv

>
> julia
>



2022-10-31 10:00:43

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Mon, Oct 31, 2022 at 12:41:40PM +0530, Deepak Varma wrote:
> On Sat, Oct 29, 2022 at 07:34:26PM +0200, Julia Lawall wrote:
> >
> >
> > On Sat, 29 Oct 2022, Deepak R Varma wrote:
> >
> > > On Sat, Oct 29, 2022 at 09:32:50AM +0200, Greg Kroah-Hartman wrote:
> > > > On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> > > > > The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> > > > > based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> > > > > number of elements in an array. Issue identified using coccicheck.
> > > > >
> > > > > Signed-off-by: Deepak R Varma <[email protected]>
> > > > > ---
> > > > > drivers/staging/fbtft/fbtft.h | 2 +-
> > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> > > > > index 2c2b5f1c1df3..5506a473be91 100644
> > > > > --- a/drivers/staging/fbtft/fbtft.h
> > > > > +++ b/drivers/staging/fbtft/fbtft.h
> > > > > @@ -231,7 +231,7 @@ struct fbtft_par {
> > > > > bool polarity;
> > > > > };
> > > > >
> > > > > -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> > > > > +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
> > > >
> > > > Please please please test-build your patches before sending them out.
> > > > To not do so just wastes reviewer resources :(
> > >
> > > Hello Greg,
> > > I did build the .ko files by making the driver/staging/fbtft/ path. I verified
> > > .o and .ko files were built.
> > >
> > > I did a make clean just now and was again able to rebuild without any errors.
> > > Please see the attached log file.
> > >
> > > Is there something wrong with the way I am firing the build?
> >
> > The change is in the definition of a macro. The compiler won't help you
> > in this case unless the macro is actually used in code that is compiled.
> > Find the uses and check for any nearby ifdefs. For file foo.c you can
> > also do make foo.i to see the result of reducing ifdef and expanding
> > macros. Then you can see if the code you changed is actually included in
> > the build.
>
> Okay. This is helpful. I understand. Looking into the file where the macro
> expansion is reported to be failed.

Hi Julia,
I could see the macro expansions in the .i files for the fbtft-core.c and
fb_hx8353d.c file. I am not sure why it built successfully on my x86 though. The
error in Kerbel bot seems to be specific to ARM arch. I will try that later
today. I am on the right track to the build error triage?

Also, while reviewing the macro expansion, I saw change in the computation that
seems odd to me. In the denominator of the expanded macro, there is a "+
((int)...." computation that I am not sure if is result of ARRAY_SIZE. I have
attached the old anf the new .i file diff for your review. If you get a change
could you help me understand why this additional computation is added to the
denominator?

Thank you,
./drv
>
> Thank you,
> ./drv
>
> >
> > julia
> >
>
>
>



2022-10-31 10:23:54

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Mon, Oct 31, 2022 at 03:10:27PM +0530, Deepak Varma wrote:
> On Mon, Oct 31, 2022 at 12:41:40PM +0530, Deepak Varma wrote:
> > On Sat, Oct 29, 2022 at 07:34:26PM +0200, Julia Lawall wrote:
> > >
> > >
> > > On Sat, 29 Oct 2022, Deepak R Varma wrote:
> > >
> > > > On Sat, Oct 29, 2022 at 09:32:50AM +0200, Greg Kroah-Hartman wrote:
> > > > > On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> > > > > > The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> > > > > > based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> > > > > > number of elements in an array. Issue identified using coccicheck.
> > > > > >
> > > > > > Signed-off-by: Deepak R Varma <[email protected]>
> > > > > > ---
> > > > > > drivers/staging/fbtft/fbtft.h | 2 +-
> > > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> > > > > > index 2c2b5f1c1df3..5506a473be91 100644
> > > > > > --- a/drivers/staging/fbtft/fbtft.h
> > > > > > +++ b/drivers/staging/fbtft/fbtft.h
> > > > > > @@ -231,7 +231,7 @@ struct fbtft_par {
> > > > > > bool polarity;
> > > > > > };
> > > > > >
> > > > > > -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> > > > > > +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
> > > > >
> > > > > Please please please test-build your patches before sending them out.
> > > > > To not do so just wastes reviewer resources :(
> > > >
> > > > Hello Greg,
> > > > I did build the .ko files by making the driver/staging/fbtft/ path. I verified
> > > > .o and .ko files were built.
> > > >
> > > > I did a make clean just now and was again able to rebuild without any errors.
> > > > Please see the attached log file.
> > > >
> > > > Is there something wrong with the way I am firing the build?
> > >
> > > The change is in the definition of a macro. The compiler won't help you
> > > in this case unless the macro is actually used in code that is compiled.
> > > Find the uses and check for any nearby ifdefs. For file foo.c you can
> > > also do make foo.i to see the result of reducing ifdef and expanding
> > > macros. Then you can see if the code you changed is actually included in
> > > the build.
> >
> > Okay. This is helpful. I understand. Looking into the file where the macro
> > expansion is reported to be failed.
>
> Hi Julia,
> I could see the macro expansions in the .i files for the fbtft-core.c and
> fb_hx8353d.c file. I am not sure why it built successfully on my x86 though. The
> error in Kerbel bot seems to be specific to ARM arch. I will try that later
> today. I am on the right track to the build error triage?
>
> Also, while reviewing the macro expansion, I saw change in the computation that
> seems odd to me. In the denominator of the expanded macro, there is a "+
> ((int)...." computation that I am not sure if is result of ARRAY_SIZE. I have
> attached the old anf the new .i file diff for your review. If you get a change
> could you help me understand why this additional computation is added to the
> denominator?

File now attached.

>
> Thank you,
> ./drv
> >
> > Thank you,
> > ./drv
> >
> > >
> > > julia
> > >
> >
> >
> >
>
>
>


Attachments:
(No filename) (3.24 kB)
fbtft-core.diff (2.36 kB)
Download all attachments

2022-10-31 12:24:45

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count



On Mon, 31 Oct 2022, Deepak R Varma wrote:

> On Mon, Oct 31, 2022 at 12:41:40PM +0530, Deepak Varma wrote:
> > On Sat, Oct 29, 2022 at 07:34:26PM +0200, Julia Lawall wrote:
> > >
> > >
> > > On Sat, 29 Oct 2022, Deepak R Varma wrote:
> > >
> > > > On Sat, Oct 29, 2022 at 09:32:50AM +0200, Greg Kroah-Hartman wrote:
> > > > > On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> > > > > > The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> > > > > > based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> > > > > > number of elements in an array. Issue identified using coccicheck.
> > > > > >
> > > > > > Signed-off-by: Deepak R Varma <[email protected]>
> > > > > > ---
> > > > > > drivers/staging/fbtft/fbtft.h | 2 +-
> > > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> > > > > > index 2c2b5f1c1df3..5506a473be91 100644
> > > > > > --- a/drivers/staging/fbtft/fbtft.h
> > > > > > +++ b/drivers/staging/fbtft/fbtft.h
> > > > > > @@ -231,7 +231,7 @@ struct fbtft_par {
> > > > > > bool polarity;
> > > > > > };
> > > > > >
> > > > > > -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> > > > > > +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
> > > > >
> > > > > Please please please test-build your patches before sending them out.
> > > > > To not do so just wastes reviewer resources :(
> > > >
> > > > Hello Greg,
> > > > I did build the .ko files by making the driver/staging/fbtft/ path. I verified
> > > > .o and .ko files were built.
> > > >
> > > > I did a make clean just now and was again able to rebuild without any errors.
> > > > Please see the attached log file.
> > > >
> > > > Is there something wrong with the way I am firing the build?
> > >
> > > The change is in the definition of a macro. The compiler won't help you
> > > in this case unless the macro is actually used in code that is compiled.
> > > Find the uses and check for any nearby ifdefs. For file foo.c you can
> > > also do make foo.i to see the result of reducing ifdef and expanding
> > > macros. Then you can see if the code you changed is actually included in
> > > the build.
> >
> > Okay. This is helpful. I understand. Looking into the file where the macro
> > expansion is reported to be failed.
>
> Hi Julia,
> I could see the macro expansions in the .i files for the fbtft-core.c and
> fb_hx8353d.c file. I am not sure why it built successfully on my x86 though. The
> error in Kerbel bot seems to be specific to ARM arch. I will try that later
> today. I am on the right track to the build error triage?
>
> Also, while reviewing the macro expansion, I saw change in the computation that
> seems odd to me. In the denominator of the expanded macro, there is a "+
> ((int)...." computation that I am not sure if is result of ARRAY_SIZE. I have
> attached the old anf the new .i file diff for your review. If you get a change
> could you help me understand why this additional computation is added to the
> denominator?

I took a look, but it's pretty complex. You could take the code and
reorganize it so that it is more readable, and then take the definition of
the ARRAY_SIZE macro, to better see what is going on.

julia

>
> Thank you,
> ./drv
> >
> > Thank you,
> > ./drv
> >
> > >
> > > julia
> > >
> >
> >
> >
>
>
>

2022-11-04 12:41:10

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Mon, Oct 31, 2022 at 01:05:32PM +0100, Julia Lawall wrote:
>
>
> I took a look, but it's pretty complex. You could take the code and
> reorganize it so that it is more readable, and then take the definition of
> the ARRAY_SIZE macro, to better see what is going on.
>
> julia
>

Hello Greg, Julia,
I was able to successfully build the fbtft object file for arm architecture as
well. I used gcc 6.5.0 and 9.5.0 tool chains. It was successful using both. I
have attached the build log from my machine for your reference.

I am also looking at the .i file and rearrange the expanded macro to understand
it. However, since it is built successfully, I am not sure if that is truly the
problem area.

Should I resend the patch and check if it still errors the kernel build bot?
Anything else I can try?

Thank you,
./drv


Attachments:
(No filename) (843.00 B)
fbtft_build.log (3.03 kB)
Download all attachments

2022-11-04 15:25:21

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Fri, Nov 04, 2022 at 05:31:24PM +0530, Deepak R Varma wrote:
> On Mon, Oct 31, 2022 at 01:05:32PM +0100, Julia Lawall wrote:
> >
> >
> > I took a look, but it's pretty complex. You could take the code and
> > reorganize it so that it is more readable, and then take the definition of
> > the ARRAY_SIZE macro, to better see what is going on.
> >
> > julia
> >
>
> Hello Greg, Julia,
> I was able to successfully build the fbtft object file for arm architecture as
> well. I used gcc 6.5.0 and 9.5.0 tool chains. It was successful using both. I
> have attached the build log from my machine for your reference.
>
> I am also looking at the .i file and rearrange the expanded macro to understand
> it. However, since it is built successfully, I am not sure if that is truly the
> problem area.
>
> Should I resend the patch and check if it still errors the kernel build bot?
> Anything else I can try?

Looks like the change I proposed is causing nesting inside the write_reg
function due to additional set of { & } brackets for the __VA_ARGS__ symbol.

Am I understanding it right?

>
> Thank you,
> ./drv




2022-11-09 15:49:10

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Fri, Nov 04, 2022 at 08:12:11PM +0530, Deepak R Varma wrote:
> On Fri, Nov 04, 2022 at 05:31:24PM +0530, Deepak R Varma wrote:
> > On Mon, Oct 31, 2022 at 01:05:32PM +0100, Julia Lawall wrote:
> > >
> > >
> > > I took a look, but it's pretty complex. You could take the code and
> > > reorganize it so that it is more readable, and then take the definition of
> > > the ARRAY_SIZE macro, to better see what is going on.
> > >
> > > julia
> > >
> >
> > Hello Greg, Julia,
> > I was able to successfully build the fbtft object file for arm architecture as
> > well. I used gcc 6.5.0 and 9.5.0 tool chains. It was successful using both. I
> > have attached the build log from my machine for your reference.
> >
> > I am also looking at the .i file and rearrange the expanded macro to understand
> > it. However, since it is built successfully, I am not sure if that is truly the
> > problem area.
> >
> > Should I resend the patch and check if it still errors the kernel build bot?
> > Anything else I can try?
>
> Looks like the change I proposed is causing nesting inside the write_reg
> function due to additional set of { & } brackets for the __VA_ARGS__ symbol.
>
> Am I understanding it right?

Hello Julia, Greg,
I am unable to reproduce this build failure on my local machine. I tried the X86
and arm based build. I am unable to troubleshoot this further. Do you have any
other suggestions? If not, I will drop this patch from my watch list.

Thank you,
./drv

>
> >
> > Thank you,
> > ./drv
>
>
>
>



2022-11-09 16:35:51

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count

On Wed, Nov 09, 2022 at 08:30:52PM +0530, Deepak R Varma wrote:
> On Fri, Nov 04, 2022 at 08:12:11PM +0530, Deepak R Varma wrote:
> > On Fri, Nov 04, 2022 at 05:31:24PM +0530, Deepak R Varma wrote:
> > > On Mon, Oct 31, 2022 at 01:05:32PM +0100, Julia Lawall wrote:
> > > >
> > > >
> > > > I took a look, but it's pretty complex. You could take the code and
> > > > reorganize it so that it is more readable, and then take the definition of
> > > > the ARRAY_SIZE macro, to better see what is going on.
> > > >
> > > > julia
> > > >
> > >
> > > Hello Greg, Julia,
> > > I was able to successfully build the fbtft object file for arm architecture as
> > > well. I used gcc 6.5.0 and 9.5.0 tool chains. It was successful using both. I
> > > have attached the build log from my machine for your reference.
> > >
> > > I am also looking at the .i file and rearrange the expanded macro to understand
> > > it. However, since it is built successfully, I am not sure if that is truly the
> > > problem area.
> > >
> > > Should I resend the patch and check if it still errors the kernel build bot?
> > > Anything else I can try?
> >
> > Looks like the change I proposed is causing nesting inside the write_reg
> > function due to additional set of { & } brackets for the __VA_ARGS__ symbol.
> >
> > Am I understanding it right?
>
> Hello Julia, Greg,
> I am unable to reproduce this build failure on my local machine. I tried the X86
> and arm based build. I am unable to troubleshoot this further. Do you have any
> other suggestions? If not, I will drop this patch from my watch list.

Please just drop it, it is not a correct change to make.

thanks,

greg k-h