RE: [PATCH net-next] net: enetc: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()
From: Wei Fang
Date: Thu May 08 2025 - 23:15:58 EST
> -static int enetc_hwtstamp_set(struct net_device *ndev, struct ifreq *ifr)
> +int enetc_hwtstamp_set(struct net_device *ndev,
> + struct kernel_hwtstamp_config *config,
> + struct netlink_ext_ack *extack)
> +EXPORT_SYMBOL_GPL(enetc_hwtstamp_set);
>
> -static int enetc_hwtstamp_get(struct net_device *ndev, struct ifreq *ifr)
> +int enetc_hwtstamp_get(struct net_device *ndev,
> + struct kernel_hwtstamp_config *config)
> +EXPORT_SYMBOL_GPL(enetc_hwtstamp_get);
The definitions of enetc_hwtstamp_set() and enetc_hwtstamp_set()
should also be wrapped with:
#if IS_ENABLED(CONFIG_FSL_ENETC_PTP_CLOCK)
#endif
Otherwise, there will be some compilation errors when
CONFIG_FSL_ENETC_PTP_CLOCK is not enabled.
> +#if IS_ENABLED(CONFIG_FSL_ENETC_PTP_CLOCK)
> +
> +int enetc_hwtstamp_get(struct net_device *ndev,
> + struct kernel_hwtstamp_config *config);
> +int enetc_hwtstamp_set(struct net_device *ndev,
> + struct kernel_hwtstamp_config *config,
> + struct netlink_ext_ack *extack);
> +
> +#else
> +
> +#define enetc_hwtstamp_get(ndev, config) NULL
> +#define enetc_hwtstamp_set(ndev, config, extack) NULL
checkpatch.pl reports some warnings, for example:
WARNING: Argument 'ndev' is not used in function-like macro
#140: FILE: drivers/net/ethernet/freescale/enetc/enetc.h:531:
+#define enetc_hwtstamp_get(ndev, config) NULL
And there are also compilation errors when
CONFIG_FSL_ENETC_PTP_CLOCK is not enabled. It should be
modified as follows.
#define enetc_hwtstamp_get NULL
#define enetc_hwtstamp_set NULL