Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Wei Fang <wei.fang@nxp.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Köry Maincent" <kory.maincent@bootlin.com>,
	"Clark Wang" <xiaoning.wang@nxp.com>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Claudiu Manoil" <claudiu.manoil@nxp.com>,
	"Simon Horman" <horms@kernel.org>,
	"Richard Cochran" <richardcochran@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net: enetc: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()
Date: Fri, 9 May 2025 13:24:03 +0300	[thread overview]
Message-ID: <20250509102403.6bpb6chwwbxoqlvw@skbuf> (raw)
In-Reply-To: <AM9PR04MB85052DADEB4DABF9C7F83BED888AA@AM9PR04MB8505.eurprd04.prod.outlook.com>

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.

  reply	other threads:[~2025-05-09 10:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 11:43 [PATCH net-next] net: enetc: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() Vladimir Oltean
2025-05-08 20:31 ` Vadim Fedorenko
2025-05-09  3:15 ` Wei Fang
2025-05-09 10:24   ` Vladimir Oltean [this message]
2025-05-09 18:37 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250509102403.6bpb6chwwbxoqlvw@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox