[arm:zii 144/161] include/linux/kernel.h:495:58: error: invalid use of undefined type 'struct axienet_pcs'

kernel test robot lkp at intel.com
Wed Nov 24 01:03:40 PST 2021


tree:   git://git.armlinux.org.uk/~rmk/linux-arm.git zii
head:   1c86335a03ee0102daaefede1fb25cdbb367b14c
commit: 9849020c16f670a3b701023ef3ae94efca71402f [144/161] net: axienet: convert to phylink_pcs
config: nios2-randconfig-r006-20211124 (https://download.01.org/0day-ci/archive/20211124/202111241704.jTohsPse-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.2.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
        git remote add arm git://git.armlinux.org.uk/~rmk/linux-arm.git
        git fetch --no-tags arm zii
        git checkout 9849020c16f670a3b701023ef3ae94efca71402f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nios2 SHELL=/bin/bash drivers/net/

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

All errors (new ones prefixed by >>):

   In file included from <command-line>:
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c: In function 'pcs_to_axienet':
>> include/linux/kernel.h:495:58: error: invalid use of undefined type 'struct axienet_pcs'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |                                                          ^~
   include/linux/compiler_types.h:302:23: note: in definition of macro '__compiletime_assert'
     302 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
   include/linux/compiler_types.h:322:9: note: in expansion of macro '_compiletime_assert'
     322 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:495:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |         ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:495:27: note: in expansion of macro '__same_type'
     495 |         BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
         |                           ^~~~~~~~~~~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1508:16: note: in expansion of macro 'container_of'
    1508 |         return container_of(pcs, struct axienet_pcs, pcs);
         |                ^~~~~~~~~~~~
   include/linux/compiler_types.h:140:41: error: invalid use of undefined type 'struct axienet_pcs'
     140 | #define __compiler_offsetof(a, b)       __builtin_offsetof(a, b)
         |                                         ^~~~~~~~~~~~~~~~~~
   include/linux/stddef.h:17:33: note: in expansion of macro '__compiler_offsetof'
      17 | #define offsetof(TYPE, MEMBER)  __compiler_offsetof(TYPE, MEMBER)
         |                                 ^~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:498:28: note: in expansion of macro 'offsetof'
     498 |         ((type *)(__mptr - offsetof(type, member))); })
         |                            ^~~~~~~~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1508:16: note: in expansion of macro 'container_of'
    1508 |         return container_of(pcs, struct axienet_pcs, pcs);
         |                ^~~~~~~~~~~~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c: In function 'axienet_pcs_get_state':
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1514:39: error: implicit declaration of function 'pcs_to_axienet_local'; did you mean 'pcs_to_axienet'? [-Werror=implicit-function-declaration]
    1514 |         struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
         |                                       ^~~~~~~~~~~~~~~~~~~~
         |                                       pcs_to_axienet
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1514:64: error: invalid type argument of '->' (have 'int')
    1514 |         struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
         |                                                                ^~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c: In function 'axienet_pcs_an_restart':
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1521:64: error: invalid type argument of '->' (have 'int')
    1521 |         struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
         |                                                                ^~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1523:40: error: 'lp' undeclared (first use in this function); did you mean 'up'?
    1523 |         phylink_mii_c22_pcs_an_restart(lp->pcs_phy);
         |                                        ^~
         |                                        up
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1523:40: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1521:29: warning: unused variable 'pcs_phy' [-Wunused-variable]
    1521 |         struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
         |                             ^~~~~~~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c: In function 'axienet_pcs_config':
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1531:60: error: invalid type argument of '->' (have 'int')
    1531 |         struct net_device *ndev = pcs_to_axienet_local(pcs)->ndev;
         |                                                            ^~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1532:64: error: invalid type argument of '->' (have 'int')
    1532 |         struct mdio_device *pcs_phy = pcs_to_axienet_local(pcs)->pcs_phy;
         |                                                                ^~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1537:29: error: 'iface' undeclared (first use in this function)
    1537 |                             iface == PHY_INTERFACE_MODE_SGMII ?
         |                             ^~~~~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c: At top level:
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1554:23: error: initialization of 'int (*)(struct phylink_pcs *, unsigned int,  phy_interface_t,  const long unsigned int *, bool)' {aka 'int (*)(struct phylink_pcs *, unsigned int,  phy_interface_t,  const long unsigned int *, _Bool)'} from incompatible pointer type 'int (*)(struct phylink_config *, unsigned int,  phy_interface_t,  const long unsigned int *, bool)' {aka 'int (*)(struct phylink_config *, unsigned int,  phy_interface_t,  const long unsigned int *, _Bool)'} [-Werror=incompatible-pointer-types]
    1554 |         .pcs_config = axienet_pcs_config,
         |                       ^~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1554:23: note: (near initialization for 'axienet_pcs_ops.pcs_config')
   drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1506:30: warning: 'pcs_to_axienet' defined but not used [-Wunused-function]
    1506 | static struct axienet_local *pcs_to_axienet(struct phylink_pcs *pcs)
         |                              ^~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +495 include/linux/kernel.h

cf14f27f82af78 Alexei Starovoitov 2018-03-28  485  
^1da177e4c3f41 Linus Torvalds     2005-04-16  486  /**
^1da177e4c3f41 Linus Torvalds     2005-04-16  487   * container_of - cast a member of a structure out to the containing structure
^1da177e4c3f41 Linus Torvalds     2005-04-16  488   * @ptr:	the pointer to the member.
^1da177e4c3f41 Linus Torvalds     2005-04-16  489   * @type:	the type of the container struct this is embedded in.
^1da177e4c3f41 Linus Torvalds     2005-04-16  490   * @member:	the name of the member within the struct.
^1da177e4c3f41 Linus Torvalds     2005-04-16  491   *
^1da177e4c3f41 Linus Torvalds     2005-04-16  492   */
^1da177e4c3f41 Linus Torvalds     2005-04-16  493  #define container_of(ptr, type, member) ({				\
c7acec713d14c6 Ian Abbott         2017-07-12  494  	void *__mptr = (void *)(ptr);					\
c7acec713d14c6 Ian Abbott         2017-07-12 @495  	BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&	\
c7acec713d14c6 Ian Abbott         2017-07-12  496  			 !__same_type(*(ptr), void),			\
c7acec713d14c6 Ian Abbott         2017-07-12  497  			 "pointer type mismatch in container_of()");	\
c7acec713d14c6 Ian Abbott         2017-07-12  498  	((type *)(__mptr - offsetof(type, member))); })
^1da177e4c3f41 Linus Torvalds     2005-04-16  499  

:::::: The code at line 495 was first introduced by commit
:::::: c7acec713d14c6ce8a20154f9dfda258d6bcad3b kernel.h: handle pointers to arrays better in container_of()

:::::: TO: Ian Abbott <abbotti at mev.co.uk>
:::::: CC: Linus Torvalds <torvalds at linux-foundation.org>

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



More information about the linux-arm-kernel mailing list