diff mbox series

[iwl-next,1/4] ice: don't compile ice_dpll.c if CONFIG_PTP_1588_CLOCK is disabled

Message ID 20230919233435.518620-2-jacob.e.keller@intel.com
State Not Applicable
Headers show
Series ice: fix linking with CONFIG_PTP_1588_CLOCK=n | expand

Commit Message

Jacob Keller Sept. 19, 2023, 11:34 p.m. UTC
The ice_dpll.c file was recently merged with support for the DPLL
interface. This feature as currently written in the ice driver depends on
the PTP infrastructure and causes compilation failures if
CONFIG_PTP_1588_CLOCK is disabled:

ld: vmlinux.o: in function `ice_dpll_init_info_direct_pins':
ice_dpll.c:(.text+0x894167): undefined reference to `ice_cgu_get_pin_freq_supp'
ld: ice_dpll.c:(.text+0x894197): undefined reference to `ice_cgu_get_pin_name'
ld: ice_dpll.c:(.text+0x8941a8): undefined reference to `ice_cgu_get_pin_type'
ld: vmlinux.o: in function `ice_dpll_update_state':
ice_dpll.c:(.text+0x894494): undefined reference to `ice_get_cgu_state'
ld: vmlinux.o: in function `ice_dpll_init':
(.text+0x8953d5): undefined reference to `ice_get_cgu_rclk_pin_info'

This occurs because the ice_dpll.c file is compiled unconditionally, but it
depends on functions in ice_ptp_hw.c which is only compiled with
CONFIG_PTP_1588_CLOCK. It might be possible to break this dependency and
expose those functions without CONFIG_PTP_1588_CLOCK, but that is not clear
to me.

For now, simply fix the Makefile to compile ice_dpll.c only when we have
PTP support enabled. Also update the ice_dpll.h header to provide no-op
fallbacks for enabling and disabling the DPLL feature in this case.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
 drivers/net/ethernet/intel/ice/Makefile   | 3 +--
 drivers/net/ethernet/intel/ice/ice_dpll.h | 6 +++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/drivers/net/ethernet/intel/ice/Makefile b/drivers/net/ethernet/intel/ice/Makefile
index 2bdd020b7939..8757bec23fb3 100644
--- a/drivers/net/ethernet/intel/ice/Makefile
+++ b/drivers/net/ethernet/intel/ice/Makefile
@@ -35,7 +35,6 @@  ice-y := ice_main.o	\
 	 ice_ethtool.o  \
 	 ice_repr.o	\
 	 ice_tc_lib.o	\
-	 ice_dpll.o	\
 	 ice_fwlog.o	\
 ice-$(CONFIG_PCI_IOV) +=	\
@@ -46,7 +45,7 @@  ice-$(CONFIG_PCI_IOV) +=	\
 	ice_vf_mbx.o		\
 	ice_vf_vsi_vlan_ops.o	\
-ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o
+ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o ice_dpll.o
 ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o
 ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o
 ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o
diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.h b/drivers/net/ethernet/intel/ice/ice_dpll.h
index 9c524c4bdfd7..2dfe764b81e1 100644
--- a/drivers/net/ethernet/intel/ice/ice_dpll.h
+++ b/drivers/net/ethernet/intel/ice/ice_dpll.h
@@ -97,8 +97,12 @@  struct ice_dplls {
 	s32 output_phase_adj_max;
 void ice_dpll_init(struct ice_pf *pf);
 void ice_dpll_deinit(struct ice_pf *pf);
+static inline void ice_dpll_init(struct ice_pf *pf) { }
+static inline void ice_dpll_deinit(struct ice_pf *pf) { }