Re: [PATCH net-next v3] net: enetc: Replace ifdef with IS_ENABLED

From: Martyn Welch
Date: Thu Sep 12 2024 - 10:02:11 EST


On Fri, 2024-09-06 at 18:20 -0700, Jakub Kicinski wrote:
> On Wed,  4 Sep 2024 11:51:41 +0100 Martyn Welch wrote:
> > -#ifdef CONFIG_FSL_ENETC_PTP_CLOCK
> > -static void enetc_get_rx_tstamp(struct net_device *ndev,
> > - union enetc_rx_bd *rxbd,
> > - struct sk_buff *skb)
> > +static void __maybe_unused enetc_get_rx_tstamp(struct net_device
> > *ndev,
> > +        union enetc_rx_bd
> > *rxbd,
> > +        struct sk_buff
> > *skb)
>
> Are you sure you need the __maybe_used's ?
> Nice thing about the IS_ENABLED() is that the code is still visible
> to
> the compiler, even if dead code elimination removes it the compiler
> shouldn't really warn about unused code.

Hi Jakub,

I thought that was required, but upon re-reading the Linux kernel
coding style documentation on the subject, I see that I miss-
understood. I will check and see.

Martyn