Thread (49 messages) 49 messages, 5 authors, 2023-10-09

Re: [PATCH v2 3/3] net: phy: add Rust Asix PHY driver

From: FUJITA Tomonori <fujita.tomonori@gmail.com>
Date: 2023-10-06 16:21:04
Also in: rust-for-linux
Subsystem: ethernet phy library, networking drivers, the rest · Maintainers: Andrew Lunn, Heiner Kallweit, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

On Fri, 6 Oct 2023 17:57:41 +0200
Andrew Lunn [off-list ref] wrote:
quoted
Now I'm thinking that this is the best option. Kconfig would be the following:

config AX88796B_PHY
        tristate "Asix PHYs"
        help
         Currently supports the Asix Electronics PHY found in the X-Surf 100
         AX88796B package.

choice
        prompt "Implementation options"
        depends on AX88796B_PHY
        help
         There are two implementations for a driver for Asix PHYs; C and Rust.
         If not sure, choose C.

config AX88796B_C_PHY
        bool "The C version driver for Asix PHYs"

config AX88796B_RUST_PHY
        bool "The Rust version driver for Asix PHYs"
        depends on RUST

endchoice


No hack in Makefile:

obj-$(CONFIG_AX88796B_C_PHY)    += ax88796b.o
obj-$(CONFIG_AX88796B_RUST_PHY) += ax88796b_rust.o
This looks reasonable. Lets use this. But i still think we need some
sort of RUST_PHYLIB_BINDING.
How about adding CONFIG_RUST_PHYLIB to the first patch. Not
selectable, it's just a flag for Rust PHYLIB support.
diff --git a/init/Kconfig b/init/Kconfig
index 4b4e3df1658d..2b6627aeb98c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1889,7 +1889,7 @@ config RUST
 	depends on !GCC_PLUGINS
 	depends on !RANDSTRUCT
 	depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE
	depends on PHYLIB=y
+	select RUST_PHYLIB
 	select CONSTRUCTORS
 	help
 	  Enables Rust support in the kernel.
@@ -1904,6 +1904,10 @@ config RUST
 
 	  If unsure, say N.
 
+config RUST_PHYLIB
+	bool
+
 config RUSTC_VERSION_TEXT
 	string
 	depends on RUST

Then the driver depends on RUST instead of RUST_PHYLIB.
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 82ecfffc276c..e0d7a19ca774 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -119,7 +119,7 @@ config AX88796B_C_PHY
 
 config AX88796B_RUST_PHY
 	bool "The Rust version driver for Asix PHYs"
-	depends on RUST
+	depends on RUST_PHYLIB
 
 endchoice
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help