diff mbox series

[Outreachy,kernel,1/4] Replace macro function by static inline function in file iss.c

Message ID b963fdc8ef989e5505b26d0c8f91315ea26c4899.1618230425.git.alinesantanacordeiro@gmail.com (mailing list archive)
State New, archived
Headers show
Series [Outreachy,kernel,1/4] Replace macro function by static inline function in file iss.c | expand

Commit Message

Aline Santana Cordeiro April 12, 2021, 12:32 p.m. UTC
Replace macro function by static inline function.
Issue suggested by Julia.

Signed-off-by: Aline Santana Cordeiro <alinesantanacordeiro@gmail.com>
---
 drivers/staging/media/omap4iss/iss.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

Comments

kernel test robot April 12, 2021, 4:05 p.m. UTC | #1
Hi Aline,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v5.12-rc7 next-20210412]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Aline-Santana-Cordeiro/Replace-macro-function-by-static-inline-function-in-file-iss-c/20210412-213252
base:   git://linuxtv.org/media_tree.git master
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
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
        # https://github.com/0day-ci/linux/commit/31032f2aa94de36a70de87f425eac62a2000367d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Aline-Santana-Cordeiro/Replace-macro-function-by-static-inline-function-in-file-iss-c/20210412-213252
        git checkout 31032f2aa94de36a70de87f425eac62a2000367d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/staging/media/omap4iss/iss.c:30:15: error: return type defaults to 'int' [-Werror=return-type]
      30 | static inline iss_print_register(iss, name)
         |               ^~~~~~~~~~~~~~~~~~
   drivers/staging/media/omap4iss/iss.c:30:15: error: function declaration isn't a prototype [-Werror=strict-prototypes]
   drivers/staging/media/omap4iss/iss.c: In function 'iss_print_register':
>> drivers/staging/media/omap4iss/iss.c:30:15: warning: old-style function definition [-Wold-style-definition]
>> drivers/staging/media/omap4iss/iss.c:30:15: warning: type of 'iss' defaults to 'int' [-Wmissing-parameter-type]
>> drivers/staging/media/omap4iss/iss.c:30:15: warning: type of 'name' defaults to 'int' [-Wmissing-parameter-type]
   In file included from include/linux/printk.h:409,
                    from include/linux/kernel.h:16,
                    from include/linux/clk.h:13,
                    from drivers/staging/media/omap4iss/iss.c:10:
   drivers/staging/media/omap4iss/iss.c:32:30: error: stray '#' in program
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |                              ^
   include/linux/dynamic_debug.h:91:14: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
      91 |   .format = (fmt),    \
         |              ^~~
   include/linux/dynamic_debug.h:147:2: note: in expansion of macro '__dynamic_func_call'
     147 |  __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:161:2: note: in expansion of macro '_dynamic_func_call'
     161 |  _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                       ^~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:2: note: in expansion of macro 'dev_dbg'
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |  ^~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:31: error: expected ')' before 'name'
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |                               ^~~~
   include/linux/dynamic_debug.h:91:14: note: in definition of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
      91 |   .format = (fmt),    \
         |              ^~~
   include/linux/dynamic_debug.h:147:2: note: in expansion of macro '__dynamic_func_call'
     147 |  __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:161:2: note: in expansion of macro '_dynamic_func_call'
     161 |  _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                       ^~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:2: note: in expansion of macro 'dev_dbg'
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |  ^~~~~~~
   include/linux/dynamic_debug.h:91:13: note: to match this '('
      91 |   .format = (fmt),    \
         |             ^
   include/linux/dynamic_debug.h:127:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
     127 |  DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt);  \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:147:2: note: in expansion of macro '__dynamic_func_call'
     147 |  __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:161:2: note: in expansion of macro '_dynamic_func_call'
     161 |  _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:2: note: in expansion of macro 'dev_dbg'
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |  ^~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:13: error: invalid type argument of '->' (have 'int')
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |             ^~
   include/linux/dynamic_debug.h:129:15: note: in definition of macro '__dynamic_func_call'
     129 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:161:2: note: in expansion of macro '_dynamic_func_call'
     161 |  _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:2: note: in expansion of macro 'dev_dbg'
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |  ^~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:30: error: stray '#' in program
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |                              ^
   include/linux/dynamic_debug.h:129:15: note: in definition of macro '__dynamic_func_call'
     129 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:161:2: note: in expansion of macro '_dynamic_func_call'
     161 |  _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~
   include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
     123 |  dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                       ^~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:2: note: in expansion of macro 'dev_dbg'
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |  ^~~~~~~
   drivers/staging/media/omap4iss/iss.c:32:31: error: expected ')' before 'name'
      32 |  dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
         |                               ^~~~


vim +30 drivers/staging/media/omap4iss/iss.c

    29	
  > 30	static inline iss_print_register(iss, name)
    31	{
    32		dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
    33			iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_##name));
    34	}
    35	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index c89f268a..3bbc39e 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -27,22 +27,24 @@ 
 #include "iss.h"
 #include "iss_regs.h"
 
-#define ISS_PRINT_REGISTER(iss, name)\
-	dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n", \
-		iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_##name))
+static inline iss_print_register(iss, name)
+{
+	dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
+		iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_##name));
+}
 
 static void iss_print_status(struct iss_device *iss)
 {
 	dev_dbg(iss->dev, "-------------ISS HL Register dump-------------\n");
 
-	ISS_PRINT_REGISTER(iss, HL_REVISION);
-	ISS_PRINT_REGISTER(iss, HL_SYSCONFIG);
-	ISS_PRINT_REGISTER(iss, HL_IRQSTATUS(5));
-	ISS_PRINT_REGISTER(iss, HL_IRQENABLE_SET(5));
-	ISS_PRINT_REGISTER(iss, HL_IRQENABLE_CLR(5));
-	ISS_PRINT_REGISTER(iss, CTRL);
-	ISS_PRINT_REGISTER(iss, CLKCTRL);
-	ISS_PRINT_REGISTER(iss, CLKSTAT);
+	iss_print_register(iss, HL_REVISION);
+	iss_print_register(iss, HL_SYSCONFIG);
+	iss_print_register(iss, HL_IRQSTATUS(5));
+	iss_print_register(iss, HL_IRQENABLE_SET(5));
+	iss_print_register(iss, HL_IRQENABLE_CLR(5));
+	iss_print_register(iss, CTRL);
+	iss_print_register(iss, CLKCTRL);
+	iss_print_register(iss, CLKSTAT);
 
 	dev_dbg(iss->dev, "-----------------------------------------------\n");
 }