From: FUJITA Tomonori <fujita.tomonori@gmail.com>
To: andrew@lunn.ch
Cc: fujita.tomonori@gmail.com, gregkh@linuxfoundation.org,
netdev@vger.kernel.org, rust-for-linux@vger.kernel.org,
miguel.ojeda.sandonis@gmail.com
Subject: Re: [PATCH v2 3/3] net: phy: add Rust Asix PHY driver
Date: Sat, 07 Oct 2023 00:26:09 +0900 (JST) [thread overview]
Message-ID: <20231007.002609.681250079112313735.fujita.tomonori@gmail.com> (raw)
In-Reply-To: <19161969-1033-4fd5-9a24-ec21d66c6735@lunn.ch>
On Fri, 6 Oct 2023 16:35:28 +0200
Andrew Lunn <andrew@lunn.ch> wrote:
>> 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.
This doesn't work.
ubuntu@ip-172-30-47-114:~/git/linux$ make LLVM=1 -j 32 menuconfig
drivers/net/phy/Kconfig:111:error: recursive dependency detected!
drivers/net/phy/Kconfig:111: symbol AX88796B_RUST_PHY depends on AX88796B_PHY
drivers/net/phy/Kconfig:104: symbol AX88796B_PHY depends on AX88796B_RUST_P
The following gurantees that only one is built but we hit the `select
AX88796B_PHY` problem in my previous mail.
config AX88796B_PHY
tristate "Asix PHYs"
help
Currently supports the Asix Electronics PHY found in the X-Surf 100
AX88796B package.
config AX88796B_RUST_PHY
bool "Rust reference driver"
depends on RUST && AX88796B_PHY=n
help
Uses the Rust version driver for Asix PHYs.
Greg, Sorry. I messed up copy-and-paste in the previous mail. I think that you meant the above.
> There is good documentation in
>
> Documentation/kbuild/kconfig-language.rst
>
>> >> +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....
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
next prev parent reply other threads:[~2023-10-06 15:26 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 9:49 [PATCH v2 0/3] Rust abstractions for network PHY drivers FUJITA Tomonori
2023-10-06 9:49 ` [PATCH v2 1/3] rust: core " FUJITA Tomonori
2023-10-07 5:06 ` Trevor Gross
2023-10-07 10:58 ` FUJITA Tomonori
2023-10-07 11:17 ` Greg KH
2023-10-07 11:23 ` FUJITA Tomonori
2023-10-07 11:30 ` Greg KH
2023-10-07 22:33 ` FUJITA Tomonori
2023-10-08 6:19 ` Trevor Gross
2023-10-08 7:49 ` FUJITA Tomonori
2023-10-08 8:54 ` Trevor Gross
2023-10-08 9:02 ` FUJITA Tomonori
2023-10-08 9:58 ` Trevor Gross
2023-10-07 23:26 ` Trevor Gross
2023-10-07 14:47 ` Andrew Lunn
2023-10-08 5:41 ` Trevor Gross
2023-10-07 15:13 ` Andrew Lunn
2023-10-08 6:07 ` Trevor Gross
2023-10-08 14:28 ` FUJITA Tomonori
2023-10-09 3:07 ` Trevor Gross
2023-10-06 9:49 ` [PATCH v2 2/3] MAINTAINERS: add Rust PHY abstractions to the ETHERNET PHY LIBRARY FUJITA Tomonori
2023-10-06 9:49 ` [PATCH v2 3/3] net: phy: add Rust Asix PHY driver FUJITA Tomonori
2023-10-06 10:31 ` Greg KH
2023-10-06 13:53 ` FUJITA Tomonori
2023-10-06 14:12 ` Greg KH
2023-10-06 14:30 ` FUJITA Tomonori
2023-10-06 14:37 ` Greg KH
2023-10-06 14:40 ` Andrew Lunn
2023-10-06 14:35 ` Andrew Lunn
2023-10-06 15:26 ` FUJITA Tomonori [this message]
2023-10-06 15:57 ` Andrew Lunn
2023-10-06 16:21 ` FUJITA Tomonori
2023-10-06 16:55 ` Andrew Lunn
2023-10-06 23:54 ` FUJITA Tomonori
2023-10-07 0:20 ` Andrew Lunn
2023-10-07 7:41 ` FUJITA Tomonori
2023-10-07 7:19 ` Trevor Gross
2023-10-07 12:07 ` FUJITA Tomonori
2023-10-07 15:39 ` Andrew Lunn
2023-10-08 7:11 ` Trevor Gross
2023-10-07 15:35 ` Andrew Lunn
2023-10-08 7:17 ` Trevor Gross
2023-10-06 12:54 ` [PATCH v2 0/3] Rust abstractions for network PHY drivers Andrew Lunn
2023-10-06 14:09 ` FUJITA Tomonori
2023-10-06 14:47 ` Andrew Lunn
2023-10-06 23:37 ` Trevor Gross
2023-10-07 3:26 ` FUJITA Tomonori
2023-10-09 12:39 ` Miguel Ojeda
2023-10-07 0:42 ` Trevor Gross
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=20231007.002609.681250079112313735.fujita.tomonori@gmail.com \
--to=fujita.tomonori@gmail.com \
--cc=andrew@lunn.ch \
--cc=gregkh@linuxfoundation.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rust-for-linux@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;
as well as URLs for NNTP newsgroup(s).