[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250509102403.6bpb6chwwbxoqlvw@skbuf>
Date: Fri, 9 May 2025 13:24:03 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: Wei Fang <wei.fang@....com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Köry Maincent <kory.maincent@...tlin.com>,
Clark Wang <xiaoning.wang@....com>, Andrew Lunn <andrew@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Simon Horman <horms@...nel.org>,
Richard Cochran <richardcochran@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net: enetc: convert to ndo_hwtstamp_get() and
ndo_hwtstamp_set()
On Fri, May 09, 2025 at 06:15:40AM +0300, Wei Fang wrote:
> > -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
>
Ah, you're right... for some reason I forgot to test with
CONFIG_FSL_ENETC_PTP_CLOCK=n :-/
I'll send v2 as follows instead:
int enetc_hwtstamp_get(struct net_device *ndev,
struct kernel_hwtstamp_config *config)
{
struct enetc_ndev_priv *priv = netdev_priv(ndev);
if (!IS_ENABLED(CONFIG_FSL_ENETC_PTP_CLOCK))
return -EOPNOTSUPP;
...
}
Much simpler to handle.
I thought that enetc_hwtstamp_get() is in a translation module that only
gets built when CONFIG_FSL_ENETC_PTP_CLOCK is enabled, but obviously
that's not true.
Powered by blists - more mailing lists