From: Andrew Lunn <andrew@lunn.ch>
To: Alistair Francis <alistair23@gmail.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux@armlinux.org.uk, hkallweit1@gmail.com,
Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH] include: mdio: Guard inline function with CONFIG_MDIO
Date: Tue, 5 Nov 2024 01:37:12 +0100 [thread overview]
Message-ID: <680bd06f-6a76-4a5c-b5d2-51dd172c8428@lunn.ch> (raw)
In-Reply-To: <CAKmqyKOX8gcRT2dSOvJY2o4bpoF+VuPmhaygJj7pTb1KesrFOQ@mail.gmail.com>
On Tue, Nov 05, 2024 at 10:21:15AM +1000, Alistair Francis wrote:
> On Mon, Nov 4, 2024 at 11:49 PM Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > On Mon, Nov 04, 2024 at 05:09:50PM +1000, Alistair Francis wrote:
> > > The static inline functions mdio45_ethtool_gset() and
> > > mdio45_ethtool_ksettings_get() call mdio45_ethtool_gset_npage() and
> > > mdio45_ethtool_ksettings_get_npage() which are both guarded by
> > > CONFIG_MDIO. So let's only expose mdio45_ethtool_gset() and
> > > mdio45_ethtool_ksettings_get() if CONFIG_MDIO is defined.
> >
> > Why? Are you fixing a linker error? A compiler error?
>
> I'm investigating generating Rust bindings for static inline functions
> (like mdio45_ethtool_gset() for example). But it fails to build when
> there are functions defined in header files that call C functions that
> aren't built due to Kconfig options.
Since this does not appear to be an issue for C, i assume these
functions are not actually used in that configuration. And this is
probably not an issue specific to MDIO. It will probably appear all
over the kernel. Adding lots of #ifdef in header files will probably
not be liked.
Does Rust have the concept of inline functions? If it is never used,
it never gets compiled? Or at least, it gets optimised out before it
gets linked, which i think is your issue here.
Andrew
next prev parent reply other threads:[~2024-11-05 0:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 7:09 Alistair Francis
2024-11-04 13:42 ` kernel test robot
2024-11-04 13:49 ` Andrew Lunn
2024-11-05 0:21 ` Alistair Francis
2024-11-05 0:37 ` Andrew Lunn [this message]
2024-11-05 1:21 ` Alistair Francis
2024-11-05 3:02 ` Andrew Lunn
2024-11-04 13:53 ` kernel test robot
2024-11-04 22:31 ` 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=680bd06f-6a76-4a5c-b5d2-51dd172c8428@lunn.ch \
--to=andrew@lunn.ch \
--cc=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
/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®