[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9efcbc51-f91d-4468-b7f3-9ded93786edb@lunn.ch>
Date: Tue, 3 Oct 2023 03:40:50 +0200
From: Andrew Lunn <andrew@...n.ch>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: miguel.ojeda.sandonis@...il.com, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v1 1/3] rust: core abstractions for network PHY drivers
On Tue, Oct 03, 2023 at 09:33:38AM +0900, FUJITA Tomonori wrote:
> On Mon, 2 Oct 2023 16:52:45 +0200
> Andrew Lunn <andrew@...n.ch> wrote:
>
> >> +//! Networking.
> >> +
> >> +#[cfg(CONFIG_PHYLIB)]
> >
> > I brought this up on the rust for linux list, but did not get a answer
> > which convinced me.
>
> Sorry, I overlooked that discussion.
>
>
> > Have you tried building this with PHYLIB as a kernel module?
>
> I've just tried and failed to build due to linker errors.
>
>
> > My understanding is that at the moment, this binding code is always
> > built in. So you somehow need to force phylib core to also be builtin.
>
> Right. It means if you add Rust bindings for a subsystem, the
> subsystem must be builtin, cannot be a module. I'm not sure if it's
> acceptable.
You just need Kconfig in the Rust code to indicate it depends on
PHYLIB. Kconfig should then remove the option to build the phylib core
as a module. And that is acceptable.
> > Or you don't build the binding, and also don't allow a module to use
> > the binding.
>
> I made PHY bindings available only if PHYLIB is builtin like the
> following. However, we want modularity for Rust support, fully or
> partially (e.g., per subsystem), I think.
>
> Miguel, I suppose that you have worked on a new build system. It can
> handle this problem?
>
>
> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> index e4d941f0ebe4..a4776fdd9b6c 100644
> --- a/drivers/net/phy/Kconfig
> +++ b/drivers/net/phy/Kconfig
> @@ -110,6 +110,7 @@ config AX88796B_PHY
> config AX88796B_RUST_PHY
> bool "Rust reference driver"
> depends on RUST && AX88796B_PHY
> + depends on PHYLIB=y
No, this is wrong. Miguel has said that leaf devices can be
modules. This driver is a leaf, all it depends on is the Rust
binding. And the Rust binding is built in, or not build at all. So the
first depends on covers that.
What is missing is that the Rust binding depends on PHYLIB.
Andrew
Powered by blists - more mailing lists