mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Edward Cree <ecree.xilinx@gmail.com>,
	Arnd Bergmann <arnd@kernel.org>,
	Martin Habets <habetsm.xilinx@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alejandro Lucero <alejandro.lucero-palau@amd.com>,
	Jonathan Cooper <jonathan.s.cooper@amd.com>,
	Netdev <netdev@vger.kernel.org>,
	linux-kernel@vger.kernel.org, Leon Romanovsky <leon@kernel.org>
Subject: Re: [PATCH] sfc: use IS_ENABLED() checks for CONFIG_SFC_SRIOV
Date: Sun, 19 Feb 2023 14:31:33 +0100	[thread overview]
Message-ID: <Y/IktbtY0rz+SVuX@corigine.com> (raw)
In-Reply-To: <9e066063-a2e7-494a-9784-2fc37ef77094@app.fastmail.com>

On Fri, Feb 17, 2023 at 05:19:26PM +0100, Arnd Bergmann wrote:
> On Fri, Feb 17, 2023, at 17:13, Edward Cree wrote:
> > On 17/02/2023 09:56, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >> 
> >> One local variable has become unused after a recent change:
> >> 
> >> drivers/net/ethernet/sfc/ef100_nic.c: In function 'ef100_probe_netdev_pf':
> >> drivers/net/ethernet/sfc/ef100_nic.c:1155:21: error: unused variable 'net_dev' [-Werror=unused-variable]
> >>   struct net_device *net_dev = efx->net_dev;
> >>                      ^~~~~~~
> >> 
> >> The variable is still used in an #ifdef. Replace the #ifdef with
> >> an if(IS_ENABLED()) check that lets the compiler see where it is
> >> used, rather than adding another #ifdef.
> >
> > So we've had Leon telling us[1] to use __maybe_unused, and you're
> >  saying to use IS_ENABLED() instead.  Which is right?
> > (And does it make any difference to build time?  I'm assuming the
> >  compiler is smart enough that this change doesn't affect text
> >  size...?)
> > -ed
> 
> Both are correct, but I prefer the IS_ENABLED() change because it
> improves build coverage. The resulting object code should be the
> same, as the dead-code-elimination in gcc takes care of removing
> it the same way.
> 
> If you use the __maybe_uninitialized annotation, you still need
> an extra fix to initialize the ef100_probe_netdev_pf() return
> code.

FWIIW, IS_ENABLED() is the approach that is more familiar to me.
Though I have nothing in particular against other approaches.

Questions of consistency aside, this patch does look good to
me and does appear to address the build problem in question - on x86_64.

Reviewed-by: Simon Horman <simon.horman@corigine.com>

  reply	other threads:[~2023-02-19 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  9:56 Arnd Bergmann
2023-02-17 16:13 ` Edward Cree
2023-02-17 16:19   ` Arnd Bergmann
2023-02-19 13:31     ` Simon Horman [this message]
2023-02-19  9:31   ` Leon Romanovsky
2023-02-20 10:50 ` patchwork-bot+netdevbpf

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=Y/IktbtY0rz+SVuX@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=alejandro.lucero-palau@amd.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=habetsm.xilinx@gmail.com \
    --cc=jonathan.s.cooper@amd.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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®