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

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

From: Andrew Lunn <andrew@lunn.ch>
Date: 2023-10-06 14:35:37
Also in: rust-for-linux

The Kconfig file would be like the following. AX88796B_RUST_PHY
depends on AX88796B_PHY so the description of AX88796B_PHY is enough?
I'll add the name of the module.


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

	depends on !AX88796B_RUST_PHY
config AX88796B_RUST_PHY
	bool "Rust reference driver"
	depends on RUST && AX88796B_PHY
And then this becomes

    	depends on RUST && !AX88796B_PHY
	default n
	help
	  Uses the Rust version driver for Asix PHYs.
You then express the mutual exclusion in Kconfig, so that only one of
AX88796B_PHY and AX88796B_RUST_PHY is ever enabled.

I've not actually tried this, so it might not work. Ideally you need
to be able disable both, so that you can enable one.

There is good documentation in

Documentation/kbuild/kconfig-language.rst
quoted
quoted
+ifdef CONFIG_AX88796B_RUST_PHY
+  obj-$(CONFIG_AX88796B_PHY)	+= ax88796b_rust.o
+else
+  obj-$(CONFIG_AX88796B_PHY)	+= ax88796b.o
+endif
This can be expressed in Kconfig, no need to put this here, right?
Not sure. Is it possible? If we allow both modules to be built, I
guess it's possible though.
If what i suggested above works, you don't need the ifdef, just list
the two drivers are normal and let Kconfig only enable one at most.
Or go back to your idea of using choice. Maybe something like

choice
	tristate "AX88796B PHY driver"

	config CONFIG_AX88796B_PHY
		bool "C driver"

	config CONFIG_AX88796B_RUST_PHY
	        bool "Rust driver"
		depends on RUST
endchoice

totally untested....

	Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help