From: Martyn Welch <martyn.welch@collabora.com>
To: Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: kernel@collabora.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: enetc: Replace ifdef with IS_ENABLED
Date: Tue, 03 Sep 2024 15:00:47 +0100 [thread overview]
Message-ID: <c47861dae9d339b9033ed71c45160009a7464888.camel@collabora.com> (raw)
In-Reply-To: <ecd830fe-28a8-4995-b4d3-fa4e5312b305@linux.dev>
On Mon, 2024-09-02 at 10:21 +0100, Vadim Fedorenko wrote:
> On 30/08/2024 18:50, Martyn Welch wrote:
> > The enetc driver uses ifdefs when checking whether
> > CONFIG_FSL_ENETC_PTP_CLOCK is enabled in a number of places. This
> > works
> > if the driver is compiled in but fails if the driver is available
> > as a
> > kernel module. Replace the instances of ifdef with use of the
> > IS_ENABLED
> > macro, that will evaluate as true when this feature is built as a
> > kernel
> > module.
> >
> > Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
> > ---
> > drivers/net/ethernet/freescale/enetc/enetc.c | 8 ++++----
> > drivers/net/ethernet/freescale/enetc/enetc.h | 4 ++--
> > drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 2 +-
> > 3 files changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c
> > b/drivers/net/ethernet/freescale/enetc/enetc.c
> > index 5c45f42232d3..276bc96dd1ef 100644
> > --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> > +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
> > @@ -977,7 +977,7 @@ static int enetc_refill_rx_ring(struct
> > enetc_bdr *rx_ring, const int buff_cnt)
> > return j;
> > }
> >
> > -#ifdef CONFIG_FSL_ENETC_PTP_CLOCK
> > +#if IS_ENABLED(CONFIG_FSL_ENETC_PTP_CLOCK)
> > static void enetc_get_rx_tstamp(struct net_device *ndev,
> > union enetc_rx_bd *rxbd,
> > struct sk_buff *skb)
> > @@ -1041,7 +1041,7 @@ static void enetc_get_offloads(struct
> > enetc_bdr *rx_ring,
> > __vlan_hwaccel_put_tag(skb, tpid,
> > le16_to_cpu(rxbd->r.vlan_opt));
> > }
> >
> > -#ifdef CONFIG_FSL_ENETC_PTP_CLOCK
> > +#if IS_ENABLED(CONFIG_FSL_ENETC_PTP_CLOCK)
> > if (priv->active_offloads & ENETC_F_RX_TSTAMP)
> > enetc_get_rx_tstamp(rx_ring->ndev, rxbd, skb);
>
> I believe IS_ENABLED can go directly to if statement and there should
> be
> no macros dances anymore. You can change these lines into
> if (IS_ENABLED(CONFIG_FSL_ENETC_PTP_CLOCK) &&
> priv->active_offloads & ENETC_F_RX_TSTAMP)
>
> The same applies to other spots in the patch.
>
Thanks, v2 on the way....
Martyn
next prev parent reply other threads:[~2024-09-03 14:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 17:50 Martyn Welch
2024-09-02 9:21 ` Vadim Fedorenko
2024-09-03 14:00 ` Martyn Welch [this message]
2024-09-03 17:04 ` Simon Horman
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=c47861dae9d339b9033ed71c45160009a7464888.camel@collabora.com \
--to=martyn.welch@collabora.com \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel@collabora.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vadim.fedorenko@linux.dev \
--cc=vladimir.oltean@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
all inboxes | Powered by JetHome®