diff mbox series

[net/master] net: ethernet: ti: cpts: Fix linker issue when TI_CPTS is defined

Message ID 20200507214740.14693-1-dmurphy@ti.com
State New
Headers show
Series [net/master] net: ethernet: ti: cpts: Fix linker issue when TI_CPTS is defined | expand

Commit Message

Dan Murphy May 7, 2020, 9:47 p.m. UTC
Fix build issue when CONFIG_TI_CPTS is defined in the defconfig but
CONFIG_TI_CPTS_MOD is not set.

arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw.o: in function `cpsw_ndo_stop':
drivers/net/ethernet/ti/cpsw.c:886: undefined reference to `cpts_unregister'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw.o: in function `cpsw_remove':
drivers/net/ethernet/ti/cpsw.c:1742: undefined reference to `cpts_release'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw.o: in function `cpsw_rx_handler':
drivers/net/ethernet/ti/cpsw.c:437: undefined reference to `cpts_rx_timestamp'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw.o: in function `cpsw_ndo_open':
drivers/net/ethernet/ti/cpsw.c:840: undefined reference to `cpts_register'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw.o: in function `cpsw_probe':
drivers/net/ethernet/ti/cpsw.c:1717: undefined reference to `cpts_release'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw_priv.o: in function `cpsw_tx_handler':
drivers/net/ethernet/ti/cpsw_priv.c:68: undefined reference to `cpts_tx_timestamp'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw_priv.o: in function `cpsw_init_common':
drivers/net/ethernet/ti/cpsw_priv.c:525: undefined reference to `cpts_create'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw_new.o: in function `cpsw_ndo_stop':
drivers/net/ethernet/ti/cpsw_new.c:814: undefined reference to `cpts_unregister'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw_new.o: in function `cpsw_remove':
drivers/net/ethernet/ti/cpsw_new.c:2029: undefined reference to `cpts_release'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw_new.o: in function `cpsw_rx_handler':
drivers/net/ethernet/ti/cpsw_new.c:379: undefined reference to `cpts_rx_timestamp'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw_new.o: in function `cpsw_probe':
drivers/net/ethernet/ti/cpsw_new.c:2005: undefined reference to `cpts_release'
arm-none-linux-gnueabihf-ld: drivers/net/ethernet/ti/cpsw_new.o: in function `cpsw_ndo_open':
drivers/net/ethernet/ti/cpsw_new.c:874: undefined reference to `cpts_register'

The header file needs to check if the CONFIG_TI_CPTS_MOD is set in order
to build the prototypes.  If not then the inline functions should be
used.

Once this change was made then a follow up error occured due to the same
flag error in the code.

drivers/net/ethernet/ti/cpsw_ethtool.c:724:30: error: dereferencing pointer to incomplete type ‘struct cpts’
 info->phc_index = cpsw->cpts->phc_index;

CC: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 drivers/net/ethernet/ti/cpsw_ethtool.c | 2 +-
 drivers/net/ethernet/ti/cpts.h         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/cpsw_ethtool.c b/drivers/net/ethernet/ti/cpsw_ethtool.c
index fa54efe3be63..31e8a76d4407 100644
--- a/drivers/net/ethernet/ti/cpsw_ethtool.c
+++ b/drivers/net/ethernet/ti/cpsw_ethtool.c
@@ -709,7 +709,7 @@  int cpsw_set_ringparam(struct net_device *ndev,
 	return ret;
 }
 
-#if IS_ENABLED(CONFIG_TI_CPTS)
+#if IS_ENABLED(CONFIG_TI_CPTS_MOD)
 int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info)
 {
 	struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h
index bb997c11ee15..548af47fa938 100644
--- a/drivers/net/ethernet/ti/cpts.h
+++ b/drivers/net/ethernet/ti/cpts.h
@@ -8,7 +8,7 @@ 
 #ifndef _TI_CPTS_H_
 #define _TI_CPTS_H_
 
-#if IS_ENABLED(CONFIG_TI_CPTS)
+#if IS_ENABLED(CONFIG_TI_CPTS_MOD)
 
 #include <linux/clk.h>
 #include <linux/clkdev.h>