[PATCH] rapidio: rio-access: remove unused macros

Ba Jing posted 1 patch 1 month, 1 week ago
drivers/rapidio/rio-access.c | 9 ---------
1 file changed, 9 deletions(-)
[PATCH] rapidio: rio-access: remove unused macros
Posted by Ba Jing 1 month, 1 week ago
By reading the code, I found these marcos are never referenced
in the code. Just remove them.

Signed-off-by: Ba Jing <bajing@cmss.chinamobile.com>
---
 drivers/rapidio/rio-access.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/rapidio/rio-access.c b/drivers/rapidio/rio-access.c
index f9e10647f94e..06135dc9a4ce 100644
--- a/drivers/rapidio/rio-access.c
+++ b/drivers/rapidio/rio-access.c
@@ -11,15 +11,6 @@
 
 #include <linux/rio_drv.h>
 
-/*
- *  Wrappers for all RIO configuration access functions.  They just check
- *  alignment and call the low-level functions pointed to by rio_mport->ops.
- */
-
-#define RIO_8_BAD 0
-#define RIO_16_BAD (offset & 1)
-#define RIO_32_BAD (offset & 3)
-
 /**
  * RIO_LOP_READ - Generate rio_local_read_config_* functions
  * @size: Size of configuration space read (8, 16, 32 bits)
-- 
2.33.0
Re: [PATCH] rapidio: rio-access: remove unused macros
Posted by kernel test robot 1 month, 1 week ago
Hi Ba,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.12-rc3 next-20241018]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ba-Jing/rapidio-rio-access-remove-unused-macros/20241017-152330
base:   linus/master
patch link:    https://lore.kernel.org/r/20241015000207.5047-1-bajing%40cmss.chinamobile.com
patch subject: [PATCH] rapidio: rio-access: remove unused macros
config: alpha-randconfig-r072-20241020 (https://download.01.org/0day-ci/archive/20241020/202410201405.3xFH0Ws9-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241020/202410201405.3xFH0Ws9-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410201405.3xFH0Ws9-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/rapidio/rio-access.c: In function '__rio_local_read_config_8':
>> drivers/rapidio/rio-access.c:29:13: error: 'RIO_8_BAD' undeclared (first use in this function)
      29 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:52:1: note: in expansion of macro 'RIO_LOP_READ'
      52 | RIO_LOP_READ(8, u8, 1)
         | ^~~~~~~~~~~~
   drivers/rapidio/rio-access.c:29:13: note: each undeclared identifier is reported only once for each function it appears in
      29 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:52:1: note: in expansion of macro 'RIO_LOP_READ'
      52 | RIO_LOP_READ(8, u8, 1)
         | ^~~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function '__rio_local_read_config_16':
>> drivers/rapidio/rio-access.c:29:13: error: 'RIO_16_BAD' undeclared (first use in this function)
      29 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:53:1: note: in expansion of macro 'RIO_LOP_READ'
      53 | RIO_LOP_READ(16, u16, 2)
         | ^~~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function '__rio_local_read_config_32':
>> drivers/rapidio/rio-access.c:29:13: error: 'RIO_32_BAD' undeclared (first use in this function)
      29 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:54:1: note: in expansion of macro 'RIO_LOP_READ'
      54 | RIO_LOP_READ(32, u32, 4)
         | ^~~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function '__rio_local_write_config_8':
   drivers/rapidio/rio-access.c:48:13: error: 'RIO_8_BAD' undeclared (first use in this function)
      48 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:55:1: note: in expansion of macro 'RIO_LOP_WRITE'
      55 | RIO_LOP_WRITE(8, u8, 1)
         | ^~~~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function '__rio_local_write_config_16':
   drivers/rapidio/rio-access.c:48:13: error: 'RIO_16_BAD' undeclared (first use in this function)
      48 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:56:1: note: in expansion of macro 'RIO_LOP_WRITE'
      56 | RIO_LOP_WRITE(16, u16, 2)
         | ^~~~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function '__rio_local_write_config_32':
   drivers/rapidio/rio-access.c:48:13: error: 'RIO_32_BAD' undeclared (first use in this function)
      48 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:57:1: note: in expansion of macro 'RIO_LOP_WRITE'
      57 | RIO_LOP_WRITE(32, u32, 4)
         | ^~~~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function 'rio_mport_read_config_8':
   drivers/rapidio/rio-access.c:81:13: error: 'RIO_8_BAD' undeclared (first use in this function); did you mean 'RIO_OP_READ'?
      81 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:105:1: note: in expansion of macro 'RIO_OP_READ'
     105 | RIO_OP_READ(8, u8, 1)
         | ^~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function 'rio_mport_read_config_16':
   drivers/rapidio/rio-access.c:81:13: error: 'RIO_16_BAD' undeclared (first use in this function)
      81 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:106:1: note: in expansion of macro 'RIO_OP_READ'
     106 | RIO_OP_READ(16, u16, 2)
         | ^~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function 'rio_mport_read_config_32':
   drivers/rapidio/rio-access.c:81:13: error: 'RIO_32_BAD' undeclared (first use in this function)
      81 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:107:1: note: in expansion of macro 'RIO_OP_READ'
     107 | RIO_OP_READ(32, u32, 4)
         | ^~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function 'rio_mport_write_config_8':
   drivers/rapidio/rio-access.c:100:13: error: 'RIO_8_BAD' undeclared (first use in this function); did you mean 'RIO_OP_READ'?
     100 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:108:1: note: in expansion of macro 'RIO_OP_WRITE'
     108 | RIO_OP_WRITE(8, u8, 1)
         | ^~~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function 'rio_mport_write_config_16':
   drivers/rapidio/rio-access.c:100:13: error: 'RIO_16_BAD' undeclared (first use in this function)
     100 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:109:1: note: in expansion of macro 'RIO_OP_WRITE'
     109 | RIO_OP_WRITE(16, u16, 2)
         | ^~~~~~~~~~~~
   drivers/rapidio/rio-access.c: In function 'rio_mport_write_config_32':
   drivers/rapidio/rio-access.c:100:13: error: 'RIO_32_BAD' undeclared (first use in this function)
     100 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^~~~
   drivers/rapidio/rio-access.c:110:1: note: in expansion of macro 'RIO_OP_WRITE'
     110 | RIO_OP_WRITE(32, u32, 4)
         | ^~~~~~~~~~~~


vim +/RIO_8_BAD +29 drivers/rapidio/rio-access.c

bd7bca4335a555 Ben Dooks (Codethink  2019-12-04  13) 
394b701ce4fbfd Matt Porter           2005-11-07  14  /**
394b701ce4fbfd Matt Porter           2005-11-07  15   * RIO_LOP_READ - Generate rio_local_read_config_* functions
394b701ce4fbfd Matt Porter           2005-11-07  16   * @size: Size of configuration space read (8, 16, 32 bits)
394b701ce4fbfd Matt Porter           2005-11-07  17   * @type: C type of value argument
394b701ce4fbfd Matt Porter           2005-11-07  18   * @len: Length of configuration space read (1, 2, 4 bytes)
394b701ce4fbfd Matt Porter           2005-11-07  19   *
394b701ce4fbfd Matt Porter           2005-11-07  20   * Generates rio_local_read_config_* functions used to access
394b701ce4fbfd Matt Porter           2005-11-07  21   * configuration space registers on the local device.
394b701ce4fbfd Matt Porter           2005-11-07  22   */
394b701ce4fbfd Matt Porter           2005-11-07  23  #define RIO_LOP_READ(size,type,len) \
394b701ce4fbfd Matt Porter           2005-11-07  24  int __rio_local_read_config_##size \
394b701ce4fbfd Matt Porter           2005-11-07  25  	(struct rio_mport *mport, u32 offset, type *value)		\
394b701ce4fbfd Matt Porter           2005-11-07  26  {									\
394b701ce4fbfd Matt Porter           2005-11-07  27  	int res;							\
394b701ce4fbfd Matt Porter           2005-11-07  28  	u32 data = 0;							\
394b701ce4fbfd Matt Porter           2005-11-07 @29  	if (RIO_##size##_BAD) return RIO_BAD_SIZE;			\
ad1e9380b17add Zhang Wei             2008-04-18  30  	res = mport->ops->lcread(mport, mport->id, offset, len, &data);	\
394b701ce4fbfd Matt Porter           2005-11-07  31  	*value = (type)data;						\
394b701ce4fbfd Matt Porter           2005-11-07  32  	return res;							\
394b701ce4fbfd Matt Porter           2005-11-07  33  }
394b701ce4fbfd Matt Porter           2005-11-07  34  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] rapidio: rio-access: remove unused macros
Posted by kernel test robot 1 month, 1 week ago
Hi Ba,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.12-rc3 next-20241018]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ba-Jing/rapidio-rio-access-remove-unused-macros/20241017-152330
base:   linus/master
patch link:    https://lore.kernel.org/r/20241015000207.5047-1-bajing%40cmss.chinamobile.com
patch subject: [PATCH] rapidio: rio-access: remove unused macros
config: i386-buildonly-randconfig-002-20241020 (https://download.01.org/0day-ci/archive/20241020/202410201348.MoFc4X0v-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241020/202410201348.MoFc4X0v-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410201348.MoFc4X0v-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/rapidio/rio-access.c:52:1: error: use of undeclared identifier 'RIO_8_BAD'
      52 | RIO_LOP_READ(8, u8, 1)
         | ^
   drivers/rapidio/rio-access.c:29:6: note: expanded from macro 'RIO_LOP_READ'
      29 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:171:1: note: expanded from here
     171 | RIO_8_BAD
         | ^
>> drivers/rapidio/rio-access.c:53:1: error: use of undeclared identifier 'RIO_16_BAD'
      53 | RIO_LOP_READ(16, u16, 2)
         | ^
   drivers/rapidio/rio-access.c:29:6: note: expanded from macro 'RIO_LOP_READ'
      29 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:174:1: note: expanded from here
     174 | RIO_16_BAD
         | ^
>> drivers/rapidio/rio-access.c:54:1: error: use of undeclared identifier 'RIO_32_BAD'
      54 | RIO_LOP_READ(32, u32, 4)
         | ^
   drivers/rapidio/rio-access.c:29:6: note: expanded from macro 'RIO_LOP_READ'
      29 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:177:1: note: expanded from here
     177 | RIO_32_BAD
         | ^
   drivers/rapidio/rio-access.c:55:1: error: use of undeclared identifier 'RIO_8_BAD'
      55 | RIO_LOP_WRITE(8, u8, 1)
         | ^
   drivers/rapidio/rio-access.c:48:6: note: expanded from macro 'RIO_LOP_WRITE'
      48 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:180:1: note: expanded from here
     180 | RIO_8_BAD
         | ^
   drivers/rapidio/rio-access.c:56:1: error: use of undeclared identifier 'RIO_16_BAD'
      56 | RIO_LOP_WRITE(16, u16, 2)
         | ^
   drivers/rapidio/rio-access.c:48:6: note: expanded from macro 'RIO_LOP_WRITE'
      48 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:183:1: note: expanded from here
     183 | RIO_16_BAD
         | ^
   drivers/rapidio/rio-access.c:57:1: error: use of undeclared identifier 'RIO_32_BAD'
      57 | RIO_LOP_WRITE(32, u32, 4)
         | ^
   drivers/rapidio/rio-access.c:48:6: note: expanded from macro 'RIO_LOP_WRITE'
      48 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:186:1: note: expanded from here
     186 | RIO_32_BAD
         | ^
   drivers/rapidio/rio-access.c:105:1: error: use of undeclared identifier 'RIO_8_BAD'
     105 | RIO_OP_READ(8, u8, 1)
         | ^
   drivers/rapidio/rio-access.c:81:6: note: expanded from macro 'RIO_OP_READ'
      81 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:25:1: note: expanded from here
      25 | RIO_8_BAD
         | ^
   drivers/rapidio/rio-access.c:106:1: error: use of undeclared identifier 'RIO_16_BAD'
     106 | RIO_OP_READ(16, u16, 2)
         | ^
   drivers/rapidio/rio-access.c:81:6: note: expanded from macro 'RIO_OP_READ'
      81 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:28:1: note: expanded from here
      28 | RIO_16_BAD
         | ^
   drivers/rapidio/rio-access.c:107:1: error: use of undeclared identifier 'RIO_32_BAD'
     107 | RIO_OP_READ(32, u32, 4)
         | ^
   drivers/rapidio/rio-access.c:81:6: note: expanded from macro 'RIO_OP_READ'
      81 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:31:1: note: expanded from here
      31 | RIO_32_BAD
         | ^
   drivers/rapidio/rio-access.c:108:1: error: use of undeclared identifier 'RIO_8_BAD'
     108 | RIO_OP_WRITE(8, u8, 1)
         | ^
   drivers/rapidio/rio-access.c:100:6: note: expanded from macro 'RIO_OP_WRITE'
     100 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:34:1: note: expanded from here
      34 | RIO_8_BAD
         | ^
   drivers/rapidio/rio-access.c:109:1: error: use of undeclared identifier 'RIO_16_BAD'
     109 | RIO_OP_WRITE(16, u16, 2)
         | ^
   drivers/rapidio/rio-access.c:100:6: note: expanded from macro 'RIO_OP_WRITE'
     100 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:37:1: note: expanded from here
      37 | RIO_16_BAD
         | ^
   drivers/rapidio/rio-access.c:110:1: error: use of undeclared identifier 'RIO_32_BAD'
     110 | RIO_OP_WRITE(32, u32, 4)
         | ^
   drivers/rapidio/rio-access.c:100:6: note: expanded from macro 'RIO_OP_WRITE'
     100 |         if (RIO_##size##_BAD) return RIO_BAD_SIZE;                      \
         |             ^
   <scratch space>:40:1: note: expanded from here
      40 | RIO_32_BAD
         | ^
   12 errors generated.


vim +/RIO_8_BAD +52 drivers/rapidio/rio-access.c

394b701ce4fbfd Matt Porter 2005-11-07  51  
394b701ce4fbfd Matt Porter 2005-11-07 @52  RIO_LOP_READ(8, u8, 1)
394b701ce4fbfd Matt Porter 2005-11-07 @53  RIO_LOP_READ(16, u16, 2)
394b701ce4fbfd Matt Porter 2005-11-07 @54  RIO_LOP_READ(32, u32, 4)
394b701ce4fbfd Matt Porter 2005-11-07  55  RIO_LOP_WRITE(8, u8, 1)
394b701ce4fbfd Matt Porter 2005-11-07  56  RIO_LOP_WRITE(16, u16, 2)
394b701ce4fbfd Matt Porter 2005-11-07  57  RIO_LOP_WRITE(32, u32, 4)
394b701ce4fbfd Matt Porter 2005-11-07  58  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki