From 4205feacdf16cdf1c9b230a4a6f541e288db6ae4 Mon Sep 17 00:00:00 2001 From: Ravi Gunasekaran <r-gunasekaran@ti.com> Date: Wed, 20 Jul 2022 12:34:01 +0530 Subject: [PATCH] net: ethernet: ti: am65-debugfs: Fix kernel crash if CONFIG_DEBUG_FS is not set in .config Kernel boot crashes if CONFIG_DEBUG_FS is not set in .config. The cpsw-nuss driver does not handle this case. Fix the issue by implementing empty debugfs APIs Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> --- drivers/net/ethernet/ti/Makefile | 3 ++- drivers/net/ethernet/ti/am65-cpsw-nuss.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile index 58a22d3c46769..24cce9c34a043 100644 --- a/drivers/net/ethernet/ti/Makefile +++ b/drivers/net/ethernet/ti/Makefile @@ -25,7 +25,8 @@ obj-$(CONFIG_TI_KEYSTONE_NETCP_ETHSS) += keystone_netcp_ethss.o keystone_netcp_ethss-y := netcp_ethss.o netcp_sgmii.o netcp_xgbepcsr.o cpsw_ale.o obj-$(CONFIG_TI_K3_AM65_CPSW_NUSS) += ti-am65-cpsw-nuss.o -ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o k3-cppi-desc-pool.o am65-cpsw-qos.o am65-debugfs.o +ti-am65-cpsw-nuss-y := am65-cpsw-nuss.o cpsw_sl.o am65-cpsw-ethtool.o cpsw_ale.o k3-cppi-desc-pool.o am65-cpsw-qos.o +ti-am65-cpsw-nuss-$(CONFIG_DEBUG_FS) += am65-debugfs.o ti-am65-cpsw-nuss-$(CONFIG_TI_K3_AM65_CPSW_SWITCHDEV) += am65-cpsw-switchdev.o obj-$(CONFIG_TI_K3_AM65_CPTS) += am65-cpts.o diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.h b/drivers/net/ethernet/ti/am65-cpsw-nuss.h index edb9c1df9d219..1874bbc37b70c 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.h +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.h @@ -201,8 +201,24 @@ int am65_cpsw_nuss_update_tx_chns(struct am65_cpsw_common *common, int num_tx); bool am65_cpsw_port_dev_check(const struct net_device *dev); +#if IS_ENABLED(CONFIG_DEBUG_FS) int am65_cpsw_nuss_register_port_debugfs(struct am65_cpsw_port *port); int am65_cpsw_nuss_register_debugfs(struct am65_cpsw_common *common); void am65_cpsw_nuss_unregister_debugfs(struct am65_cpsw_common *common); +#else +static inline int am65_cpsw_nuss_register_port_debugfs(struct am65_cpsw_port *port) +{ + return 0; +} + +static inline int am65_cpsw_nuss_register_debugfs(struct am65_cpsw_common *common) +{ + return 0; +} + +static inline void am65_cpsw_nuss_unregister_debugfs(struct am65_cpsw_common *common) +{ +} +#endif #endif /* AM65_CPSW_NUSS_H_ */ -- GitLab