diff mbox

net: hisilicon: add OF dependency

Message ID 4665385.OoIztz6y5m@wuerfel
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Arnd Bergmann Oct. 16, 2015, 9:33 a.m. UTC
The HNS MDIO driver fails to build on older ARM machines that are not
yet converted to CONFIG_OF:

drivers/net/ethernet/hisilicon/hns_mdio.c: In function 'hns_mdio_bus_name':
drivers/net/ethernet/hisilicon/hns_mdio.c:405:14: error: 'OF_BAD_ADDR' undeclared (first use in this function)
  u64 taddr = OF_BAD_ADDR;
              ^
drivers/net/ethernet/hisilicon/hns_mdio.c:405:14: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/hisilicon/hns_mdio.c:409:11: error: implicit declaration of function 'of_translate_address' [-Werror=implicit-function-declaration]
   taddr = of_translate_address(np, addr);
           ^

This clarifies the dependency to ensure we don't attempt to build these
drivers without CONFIG_OF, but also adds a COMPILE_TEST alternative to
give us better build coverage testing.

Build-tested on x86 as well to ensure this actually works.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

kernel test robot Oct. 16, 2015, 5:03 p.m. UTC | #1
Hi Arnd,

[auto build test ERROR on net-next/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/net-hisilicon-add-OF-dependency/20151016-173818
config: x86_64-allmodconfig
reproduce:
        make ARCH=x86_64  allmodconfig
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):


vim +/vzalloc +1123 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c

511e6bc0 huangdaode 2015-09-17  1117  
511e6bc0 huangdaode 2015-09-17  1118  	ret = hns_dsaf_init_hw(dsaf_dev);
511e6bc0 huangdaode 2015-09-17  1119  	if (ret)
511e6bc0 huangdaode 2015-09-17  1120  		return ret;
511e6bc0 huangdaode 2015-09-17  1121  
511e6bc0 huangdaode 2015-09-17  1122  	/* malloc mem for tcam mac key(vlan+mac) */
511e6bc0 huangdaode 2015-09-17 @1123  	priv->soft_mac_tbl = vzalloc(sizeof(*priv->soft_mac_tbl)
511e6bc0 huangdaode 2015-09-17  1124  		  * DSAF_TCAM_SUM);
511e6bc0 huangdaode 2015-09-17  1125  	if (!priv->soft_mac_tbl) {
511e6bc0 huangdaode 2015-09-17  1126  		ret = -ENOMEM;
511e6bc0 huangdaode 2015-09-17  1127  		goto remove_hw;
511e6bc0 huangdaode 2015-09-17  1128  	}
511e6bc0 huangdaode 2015-09-17  1129  
511e6bc0 huangdaode 2015-09-17  1130  	/*all entry invall */
511e6bc0 huangdaode 2015-09-17  1131  	for (i = 0; i < DSAF_TCAM_SUM; i++)
511e6bc0 huangdaode 2015-09-17  1132  		(priv->soft_mac_tbl + i)->index = DSAF_INVALID_ENTRY_IDX;
511e6bc0 huangdaode 2015-09-17  1133  
511e6bc0 huangdaode 2015-09-17  1134  	return 0;
511e6bc0 huangdaode 2015-09-17  1135  
511e6bc0 huangdaode 2015-09-17  1136  remove_hw:
511e6bc0 huangdaode 2015-09-17  1137  	hns_dsaf_remove_hw(dsaf_dev);
511e6bc0 huangdaode 2015-09-17  1138  	return ret;
511e6bc0 huangdaode 2015-09-17  1139  }
511e6bc0 huangdaode 2015-09-17  1140  
511e6bc0 huangdaode 2015-09-17  1141  /**
511e6bc0 huangdaode 2015-09-17  1142   * hns_dsaf_free - free dsa fabric
511e6bc0 huangdaode 2015-09-17  1143   * @dsaf_dev: dsa fabric device struct pointer
511e6bc0 huangdaode 2015-09-17  1144   */
511e6bc0 huangdaode 2015-09-17  1145  static void hns_dsaf_free(struct dsaf_device *dsaf_dev)
511e6bc0 huangdaode 2015-09-17  1146  {
511e6bc0 huangdaode 2015-09-17  1147  	struct dsaf_drv_priv *priv =
511e6bc0 huangdaode 2015-09-17  1148  	    (struct dsaf_drv_priv *)hns_dsaf_dev_priv(dsaf_dev);
511e6bc0 huangdaode 2015-09-17  1149  
511e6bc0 huangdaode 2015-09-17  1150  	hns_dsaf_remove_hw(dsaf_dev);
511e6bc0 huangdaode 2015-09-17  1151  
511e6bc0 huangdaode 2015-09-17  1152  	/* free all mac mem */
511e6bc0 huangdaode 2015-09-17 @1153  	vfree(priv->soft_mac_tbl);
511e6bc0 huangdaode 2015-09-17  1154  	priv->soft_mac_tbl = NULL;
511e6bc0 huangdaode 2015-09-17  1155  }
511e6bc0 huangdaode 2015-09-17  1156  

:::::: The code at line 1123 was first introduced by commit
:::::: 511e6bc071db1484d1a3d1d0bd4c244cf33910ff net: add Hisilicon Network Subsystem DSAF support

:::::: TO: huangdaode <huangdaode@hisilicon.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot Oct. 16, 2015, 6:16 p.m. UTC | #2
Hi Arnd,

[auto build test ERROR on net-next/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/net-hisilicon-add-OF-dependency/20151016-173818
config: um-allyesconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=um 

All errors (new ones prefixed by >>):

   drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_get_cfg':
>> drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c:151:3: error: implicit declaration of function 'iounmap' [-Werror=implicit-function-declaration]
      iounmap(dsaf_dev->io_base);
      ^
   cc1: some warnings being treated as errors

vim +/iounmap +151 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c

511e6bc0 huangdaode 2015-09-17  135  	dsaf_dev->buf_size_type = hns_rcb_buf_size2type(buf_size);
511e6bc0 huangdaode 2015-09-17  136  	if (dsaf_dev->buf_size_type < 0) {
511e6bc0 huangdaode 2015-09-17  137  		dev_err(dsaf_dev->dev,
511e6bc0 huangdaode 2015-09-17  138  			"buf_size(%d) is wrong!\n", buf_size);
511e6bc0 huangdaode 2015-09-17  139  		goto unmap_base_addr;
511e6bc0 huangdaode 2015-09-17  140  	}
511e6bc0 huangdaode 2015-09-17  141  
511e6bc0 huangdaode 2015-09-17  142  	if (!dma_set_mask_and_coherent(dsaf_dev->dev, DMA_BIT_MASK(64ULL)))
511e6bc0 huangdaode 2015-09-17  143  		dev_dbg(dsaf_dev->dev, "set mask to 64bit\n");
511e6bc0 huangdaode 2015-09-17  144  	else
511e6bc0 huangdaode 2015-09-17  145  		dev_err(dsaf_dev->dev, "set mask to 64bit fail!\n");
511e6bc0 huangdaode 2015-09-17  146  
511e6bc0 huangdaode 2015-09-17  147  	return 0;
511e6bc0 huangdaode 2015-09-17  148  
511e6bc0 huangdaode 2015-09-17  149  unmap_base_addr:
511e6bc0 huangdaode 2015-09-17  150  	if (dsaf_dev->io_base)
511e6bc0 huangdaode 2015-09-17 @151  		iounmap(dsaf_dev->io_base);
511e6bc0 huangdaode 2015-09-17  152  	if (dsaf_dev->ppe_base)
511e6bc0 huangdaode 2015-09-17  153  		iounmap(dsaf_dev->ppe_base);
511e6bc0 huangdaode 2015-09-17  154  	if (dsaf_dev->sds_base)
511e6bc0 huangdaode 2015-09-17  155  		iounmap(dsaf_dev->sds_base);
511e6bc0 huangdaode 2015-09-17  156  	if (dsaf_dev->sc_base)
511e6bc0 huangdaode 2015-09-17  157  		iounmap(dsaf_dev->sc_base);
511e6bc0 huangdaode 2015-09-17  158  	if (dsaf_dev->cpld_base)
511e6bc0 huangdaode 2015-09-17  159  		iounmap(dsaf_dev->cpld_base);

:::::: The code at line 151 was first introduced by commit
:::::: 511e6bc071db1484d1a3d1d0bd4c244cf33910ff net: add Hisilicon Network Subsystem DSAF support

:::::: TO: huangdaode <huangdaode@hisilicon.com>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Joe Perches Oct. 16, 2015, 6:22 p.m. UTC | #3
On Sat, 2015-10-17 at 02:16 +0800, kbuild test robot wrote:
> All errors (new ones prefixed by >>):
>    drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c: In function 'hns_dsaf_get_cfg':
> >> drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c:151:3: error: implicit declaration of function 'iounmap' [-Werror=implicit-function-declaration]
>       iounmap(dsaf_dev->io_base);
>       ^
>    cc1: some warnings being treated as errors
> 
> vim +/iounmap +151 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
[]
> 511e6bc0 huangdaode 2015-09-17  142  	if (!dma_set_mask_and_coherent(dsaf_dev->dev, DMA_BIT_MASK(64ULL)))

btw: this should be DMA_BIT_MASK(64) without the ULL



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot Oct. 16, 2015, 6:39 p.m. UTC | #4
Hi Arnd,

[auto build test WARNING on net-next/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/net-hisilicon-add-OF-dependency/20151016-173818
config: ia64-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All warnings (new ones prefixed by >>):

   In file included from arch/ia64/include/asm/smp.h:20:0,
                    from include/linux/smp.h:59,
                    from include/linux/topology.h:33,
                    from include/linux/gfp.h:8,
                    from include/linux/kmod.h:22,
                    from include/linux/module.h:13,
                    from drivers/net/ethernet/hisilicon/hix5hd2_gmac.c:10:
   drivers/net/ethernet/hisilicon/hix5hd2_gmac.c: In function 'hix5hd2_port_disable':
   arch/ia64/include/asm/io.h:398:38: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define writel_relaxed(v,a) __writel((v), (a))
                                         ^
>> drivers/net/ethernet/hisilicon/hix5hd2_gmac.c:374:2: note: in expansion of macro 'writel_relaxed'
     writel_relaxed(~(BITS_RX_EN | BITS_TX_EN), priv->base + PORT_EN);
     ^

vim +/writel_relaxed +374 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c

57c5bc9a Zhangfei Gao 2014-06-03  358  	writel_relaxed(DEF_INT_MASK, priv->base + ENA_PMU_INT);
57c5bc9a Zhangfei Gao 2014-06-03  359  }
57c5bc9a Zhangfei Gao 2014-06-03  360  
57c5bc9a Zhangfei Gao 2014-06-03  361  static void hix5hd2_irq_disable(struct hix5hd2_priv *priv)
57c5bc9a Zhangfei Gao 2014-06-03  362  {
57c5bc9a Zhangfei Gao 2014-06-03  363  	writel_relaxed(0, priv->base + ENA_PMU_INT);
57c5bc9a Zhangfei Gao 2014-06-03  364  }
57c5bc9a Zhangfei Gao 2014-06-03  365  
57c5bc9a Zhangfei Gao 2014-06-03  366  static void hix5hd2_port_enable(struct hix5hd2_priv *priv)
57c5bc9a Zhangfei Gao 2014-06-03  367  {
57c5bc9a Zhangfei Gao 2014-06-03  368  	writel_relaxed(0xf, priv->base + DESC_WR_RD_ENA);
57c5bc9a Zhangfei Gao 2014-06-03  369  	writel_relaxed(BITS_RX_EN | BITS_TX_EN, priv->base + PORT_EN);
57c5bc9a Zhangfei Gao 2014-06-03  370  }
57c5bc9a Zhangfei Gao 2014-06-03  371  
57c5bc9a Zhangfei Gao 2014-06-03  372  static void hix5hd2_port_disable(struct hix5hd2_priv *priv)
57c5bc9a Zhangfei Gao 2014-06-03  373  {
57c5bc9a Zhangfei Gao 2014-06-03 @374  	writel_relaxed(~(BITS_RX_EN | BITS_TX_EN), priv->base + PORT_EN);
57c5bc9a Zhangfei Gao 2014-06-03  375  	writel_relaxed(0, priv->base + DESC_WR_RD_ENA);
57c5bc9a Zhangfei Gao 2014-06-03  376  }
57c5bc9a Zhangfei Gao 2014-06-03  377  
57c5bc9a Zhangfei Gao 2014-06-03  378  static void hix5hd2_hw_set_mac_addr(struct net_device *dev)
57c5bc9a Zhangfei Gao 2014-06-03  379  {
57c5bc9a Zhangfei Gao 2014-06-03  380  	struct hix5hd2_priv *priv = netdev_priv(dev);
57c5bc9a Zhangfei Gao 2014-06-03  381  	unsigned char *mac = dev->dev_addr;
57c5bc9a Zhangfei Gao 2014-06-03  382  	u32 val;

:::::: The code at line 374 was first introduced by commit
:::::: 57c5bc9ad7d799e9507ba6e993398d2c55f03fab net: hisilicon: add hix5hd2 mac driver

:::::: TO: Zhangfei Gao <zhangfei.gao@linaro.org>
:::::: CC: David S. Miller <davem@davemloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Arnd Bergmann Oct. 16, 2015, 7:10 p.m. UTC | #5
On Saturday 17 October 2015 02:39:51 kbuild test robot wrote:
> 
> [auto build test WARNING on net-next/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
> 
> url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/net-hisilicon-add-OF-dependency/20151016-173818
> config: ia64-allmodconfig (attached as .config)
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=ia64 
> 

I guess I should have sent my three patches as a series. The build bot
found the same two bugs I had found myself and sent fixes for, but
applying the 'add OF dependency' without the other two makes them appear
in more configurations.

For all I can see, the two reports here are fixed if all three of my
patches are applied.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 19, 2015, 3:01 a.m. UTC | #6
From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 16 Oct 2015 11:33:49 +0200

> The HNS MDIO driver fails to build on older ARM machines that are not
> yet converted to CONFIG_OF:
> 
> drivers/net/ethernet/hisilicon/hns_mdio.c: In function 'hns_mdio_bus_name':
> drivers/net/ethernet/hisilicon/hns_mdio.c:405:14: error: 'OF_BAD_ADDR' undeclared (first use in this function)
>   u64 taddr = OF_BAD_ADDR;
>               ^
> drivers/net/ethernet/hisilicon/hns_mdio.c:405:14: note: each undeclared identifier is reported only once for each function it appears in
> drivers/net/ethernet/hisilicon/hns_mdio.c:409:11: error: implicit declaration of function 'of_translate_address' [-Werror=implicit-function-declaration]
>    taddr = of_translate_address(np, addr);
>            ^
> 
> This clarifies the dependency to ensure we don't attempt to build these
> drivers without CONFIG_OF, but also adds a COMPILE_TEST alternative to
> give us better build coverage testing.
> 
> Build-tested on x86 as well to ensure this actually works.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/hisilicon/Kconfig b/drivers/net/ethernet/hisilicon/Kconfig
index 8d12b587809e..f250dec488fd 100644
--- a/drivers/net/ethernet/hisilicon/Kconfig
+++ b/drivers/net/ethernet/hisilicon/Kconfig
@@ -5,7 +5,7 @@ 
 config NET_VENDOR_HISILICON
 	bool "Hisilicon devices"
 	default y
-	depends on ARM || ARM64
+	depends on OF && (ARM || ARM64 || COMPILE_TEST)
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y.