Subject: Re: [PATCH 1/3] net: stmmac: use fwnode instead of of to configure driver

From: kernel test robot <[email-masked]>
Date: Mon, 10 Oct 2022 03:43:19 +0800

Hi Soha,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on next-20221007]
[cannot apply to sunxi/sunxi/for-next shawnguo/for-next atorgue-stm32/stm32-next v6.0]
[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/Soha-Jin/net-stmmac-probing-config-with-fwnode-instead-of-of/20221010-002500
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git a6afa4199d3d038fbfdff5511f7523b0e30cb774
config: hexagon-randconfig-r016-20221009
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
        # https://github.com/intel-lab-lkp/linux/commit/c51973c370777f2f4fd307ce3d0d6ff008f93904
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Soha-Jin/net-stmmac-probing-config-with-fwnode-instead-of-of/20221010-002500
        git checkout c51973c370777f2f4fd307ce3d0d6ff008f93904
        # 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=hexagon SHELL=/bin/bash drivers/net/ethernet/stmicro/stmmac/

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

All errors (new ones prefixed by >>):

   In file included from drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:14:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:14:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:14:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:330:15: error: call to undeclared function 'fwnode_phy_is_fixed_link'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
           bool mdio = !fwnode_phy_is_fixed_link(fwnode);
                        ^
>> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:332:6: error: call to undeclared function 'fwnode_is_compatible'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
           if (fwnode_is_compatible(fwnode, "snps,dwc-qos-ethernet-4.10")) {
               ^
   drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:552:6: error: call to undeclared function 'fwnode_is_compatible'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
           if (fwnode_is_compatible(fwnode, "st,spear600-gmac") ||
               ^
   6 warnings and 3 errors generated.

vim +/fwnode_phy_is_fixed_link +330 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

   300	
   301	/**
   302	 * stmmac_parse_phy - parse driver parameters to allocate PHY resources
   303	 * @plat: driver data platform structure
   304	 * @fwnode: fwnode handle
   305	 * @dev: device pointer
   306	 * Description:
   307	 * The mdio bus will be allocated in case of a phy transceiver is on board;
   308	 * it will be NULL if the fixed-link is configured.
   309	 * If there is the "snps,dwmac-mdio" sub-node the mdio will be allocated
   310	 * in any case (for DSA, mdio must be registered even if fixed-link).
   311	 * The table below sums the supported configurations:
   312	 *	-------------------------------
   313	 *	snps,phy-addr	|     Y
   314	 *	-------------------------------
   315	 *	phy-handle	|     Y
   316	 *	-------------------------------
   317	 *	fixed-link	|     N
   318	 *	-------------------------------
   319	 *	snps,dwmac-mdio	|
   320	 *	  even if	|     Y
   321	 *	fixed-link	|
   322	 *	-------------------------------
   323	 *
   324	 * It returns 0 in case of success otherwise -ENODEV.
   325	 */
   326	static int stmmac_parse_phy(struct plat_stmmacenet_data *plat,
   327				    struct fwnode_handle *fwnode)
   328	{
   329		struct device *dev = fwnode->dev;
 > 330		bool mdio = !fwnode_phy_is_fixed_link(fwnode);
   331	
 > 332		if (fwnode_is_compatible(fwnode, "snps,dwc-qos-ethernet-4.10")) {
   333			plat->mdio_node = fwnode_get_named_child_node(fwnode, "mdio");
   334		} else {
   335			/**
   336			 * If snps,dwmac-mdio is passed from properties, always register
   337			 * the MDIO
   338			 */
   339			fwnode_for_each_child_node(fwnode, plat->mdio_node) {
   340				if (fwnode_is_compatible(plat->mdio_node,
   341							 "snps,dwmac-mdio"))
   342					break;
   343			}
   344		}
   345	
   346		if (plat->mdio_node) {
   347			dev_dbg(dev, "Found MDIO subnode\n");
   348			mdio = true;
   349		}
   350	
   351		if (mdio) {
   352			plat->mdio_bus_data =
   353				devm_kzalloc(dev, sizeof(struct stmmac_mdio_bus_data),
   354					     GFP_KERNEL);
   355			if (!plat->mdio_bus_data)
   356				return -ENOMEM;
   357	
   358			plat->mdio_bus_data->needs_reset = true;
   359		}
   360	
   361		return 0;
   362	}
   363	

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