Skip to contentSkip to conversation

staging: fbtft: fix macro usage and style warnings

PATCH In review DeepanshuPratik 3 participants 3 messages Sep 19, 2025 – Oct 18, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: fbtft: fix macro usage and style warnings

This patch fixes the trailing comma issue in the define_fbtft_write_reg() macro calls, which caused checkpatch.pl to complain with:

ERROR: space prohibited before that close parenthesis ')'

The affected macro invocations were updated to pass an identity modifier instead of leaving the argument empty. This resolves build errors while ensuring compliance with kernel coding style.

No functional changes are introduced; this patch only addresses build and style issues.

---
 drivers/staging/fbtft/fbtft-bus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/fbtft/fbtft-bus.c +3 -2
index 30e436ff1..60846185d 100644
@@ -11,6 +11,7 @@
  *
  *****************************************************************************/
 
+#define NOOP(x) (x)                                                           \
 #define define_fbtft_write_reg(func, buffer_type, data_type, modifier)        \
 void func(struct fbtft_par *par, int len, ...)                                \
 {                                                                             \
@@ -62,9 +63,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, NOOP)
 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, NOOP)
 
 void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 {
Signature · 1 line
2.43.0
#1 lore raw
kernel test robot noticed the following build errors:

Hi DeepanshuPratik,

kernel test robot noticed the following build errors:

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

url:    https://github.com/intel-lab-lkp/linux/commits/DeepanshuPratik/staging-fbtft-fix-macro-usage-and-style-warnings/20250920-053248
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20250919212938.822374-1-deepanshu.pratik%40gmail.com
patch subject: [PATCH] staging: fbtft: fix macro usage and style warnings
config: x86_64-buildonly-randconfig-002-20250920 (https://download.01.org/0day-ci/archive/20250920/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250920/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/staging/fbtft/fbtft-bus.c:15:2: error: '#' is not followed by a macro parameter
      15 | #define define_fbtft_write_reg(func, buffer_type, data_type, modifier)        \
         |  ^
>> drivers/staging/fbtft/fbtft-bus.c:66:47: error: unexpected type name 'u8': expected identifier
      66 | define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, NOOP)
         |                                               ^
   drivers/staging/fbtft/fbtft-bus.c:66:51: error: unexpected type name 'u8': expected identifier
      66 | define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, NOOP)
         |                                                   ^
>> drivers/staging/fbtft/fbtft-bus.c:66:51: error: redefinition of parameter 'u8'
>> drivers/staging/fbtft/fbtft-bus.c:67:1: error: expected function body after function declarator
      67 | define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
         | ^

5 errors generated.

vim +15 drivers/staging/fbtft/fbtft-bus.c

c296d5f9957c039 Thomas Petazzoni   2014-12-31   7  
c296d5f9957c039 Thomas Petazzoni   2014-12-31   8  /*****************************************************************************
c296d5f9957c039 Thomas Petazzoni   2014-12-31   9   *
c296d5f9957c039 Thomas Petazzoni   2014-12-31  10   *   void (*write_reg)(struct fbtft_par *par, int len, ...);
c296d5f9957c039 Thomas Petazzoni   2014-12-31  11   *
c296d5f9957c039 Thomas Petazzoni   2014-12-31  12   *****************************************************************************/
c296d5f9957c039 Thomas Petazzoni   2014-12-31  13  
49f31092c55579e DeepanshuPratik    2025-09-20  14  #define NOOP(x) (x)                                                           \
8d8825b420ffb37 Alfonso Lima Astor 2017-10-17 @15  #define define_fbtft_write_reg(func, buffer_type, data_type, modifier)        \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  16  void func(struct fbtft_par *par, int len, ...)                                \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  17  {                                                                             \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  18  	va_list args;                                                         \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  19  	int i, ret;                                                           \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  20  	int offset = 0;                                                       \
8d8825b420ffb37 Alfonso Lima Astor 2017-10-17  21  	buffer_type *buf = (buffer_type *)par->buf;                           \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  22  									      \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  23  	if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) {                    \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  24  		va_start(args, len);                                          \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  25  		for (i = 0; i < len; i++) {                                   \
cc1c0eea8527bd2 Renato Soma        2018-04-17  26  			buf[i] = modifier((data_type)va_arg(args,             \
cc1c0eea8527bd2 Renato Soma        2018-04-17  27  							    unsigned int));   \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  28  		}                                                             \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  29  		va_end(args);                                                 \
cc1c0eea8527bd2 Renato Soma        2018-04-17  30  		fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par,                  \
cc1c0eea8527bd2 Renato Soma        2018-04-17  31  				  par->info->device, buffer_type, buf, len,   \
cc1c0eea8527bd2 Renato Soma        2018-04-17  32  				  "%s: ", __func__);                          \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  33  	}                                                                     \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  34  									      \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  35  	va_start(args, len);                                                  \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  36  									      \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  37  	if (par->startbyte) {                                                 \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  38  		*(u8 *)par->buf = par->startbyte;                             \
8d8825b420ffb37 Alfonso Lima Astor 2017-10-17  39  		buf = (buffer_type *)(par->buf + 1);                          \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  40  		offset = 1;                                                   \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  41  	}                                                                     \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  42  									      \
8d8825b420ffb37 Alfonso Lima Astor 2017-10-17  43  	*buf = modifier((data_type)va_arg(args, unsigned int));               \
cc1c0eea8527bd2 Renato Soma        2018-04-17  44  	ret = fbtft_write_buf_dc(par, par->buf, sizeof(data_type) + offset,   \
cc1c0eea8527bd2 Renato Soma        2018-04-17  45  				 0);                                          \
e70065fdc11d86f Heiner Kallweit    2017-03-02  46  	if (ret < 0)							      \
e70065fdc11d86f Heiner Kallweit    2017-03-02  47  		goto out;						      \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  48  	len--;                                                                \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  49  									      \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  50  	if (par->startbyte)                                                   \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  51  		*(u8 *)par->buf = par->startbyte | 0x2;                       \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  52  									      \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  53  	if (len) {                                                            \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  54  		i = len;                                                      \
e70065fdc11d86f Heiner Kallweit    2017-03-02  55  		while (i--)						      \
cc1c0eea8527bd2 Renato Soma        2018-04-17  56  			*buf++ = modifier((data_type)va_arg(args,             \
cc1c0eea8527bd2 Renato Soma        2018-04-17  57  							    unsigned int));   \
e70065fdc11d86f Heiner Kallweit    2017-03-02  58  		fbtft_write_buf_dc(par, par->buf,			      \
8d8825b420ffb37 Alfonso Lima Astor 2017-10-17  59  				   len * (sizeof(data_type) + offset), 1);    \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  60  	}                                                                     \
e70065fdc11d86f Heiner Kallweit    2017-03-02  61  out:									      \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  62  	va_end(args);                                                         \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  63  }                                                                             \
c296d5f9957c039 Thomas Petazzoni   2014-12-31  64  EXPORT_SYMBOL(func);
c296d5f9957c039 Thomas Petazzoni   2014-12-31  65  
49f31092c55579e DeepanshuPratik    2025-09-20 @66  define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, NOOP)
8d8825b420ffb37 Alfonso Lima Astor 2017-10-17 @67  define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
49f31092c55579e DeepanshuPratik    2025-09-20  68  define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, NOOP)

c296d5f9957c039 Thomas Petazzoni 2014-12-31 69

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#2 lore raw
In reply to DeepanshuPratik
Quoted 5 lines · DeepanshuPratik

This patch fixes the trailing comma issue in the define_fbtft_write_reg() macro calls, which caused checkpatch.pl to complain with:

ERROR: space prohibited before that close parenthesis ')'

Please. go and fix checkpatch instead.

Quoted 7 lines

The affected macro invocations were updated to pass an identity modifier instead of leaving the argument empty. This resolves build errors while ensuring compliance with kernel coding style.

No functional changes are introduced; this patch only addresses build and style issues.

Signature · 2 lines
With Best Regards,
Andy Shevchenko