Skip to contentSkip to conversation

net: ethernet: ti: cpts: Fix linker issue when TI_CPTS is defined

PATCH In review Dan Murphy 1 participant 2 messages May 7, 2020 – May 8, 2020

Subsystems (3)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH 1/1 net: ethernet: ti: cpts: Fix linker issue when TI_CPTS is defined

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 <[email protected]>
---
 drivers/net/ethernet/ti/cpsw_ethtool.c | 2 +-
 drivers/net/ethernet/ti/cpts.h         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/cpsw_ethtool.c +1 -1
index fa54efe3be63..31e8a76d4407 100644
@@ -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);
drivers/net/ethernet/ti/cpts.h +1 -1
index bb997c11ee15..548af47fa938 100644
@@ -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>
Signature · 1 line
2.25.1
author
#1 lore raw

All

Quoted 2 lines · Dan Murphy

Fix build issue when CONFIG_TI_CPTS is defined in the defconfig but CONFIG_TI_CPTS_MOD is not set.

I see this already has a pending patch to fix this so unless this solution is better I will drop the patch

https://lore.kernel.org/patchwork/patch/1235642/

Dan