rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: FUJITA Tomonori <fujita.tomonori@gmail.com>
To: miguel.ojeda.sandonis@gmail.com
Cc: fujita.tomonori@gmail.com, rust-for-linux@vger.kernel.org,
	andrew@lunn.ch, tmgross@umich.edu
Subject: Re: [RFC PATCH v2 3/3] net: phy: add Rust Asix PHY driver
Date: Sun, 24 Sep 2023 20:00:56 +0900 (JST)	[thread overview]
Message-ID: <20230924.200056.171141856238500181.fujita.tomonori@gmail.com> (raw)
In-Reply-To: <CANiq72m_jv3a2umn-Ogho+c1zs5+=1XuVjE3K7mhw9w6gwR3Rw@mail.gmail.com>

On Sun, 24 Sep 2023 12:10:58 +0200
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:

> On Sun, Sep 24, 2023 at 11:38 AM FUJITA Tomonori
> <fujita.tomonori@gmail.com> wrote:
>>
>> With that approach, you can enable both C and Rust versions? It might
>> breaks auto-module-loading.
> 
> No, I meant that it would still be one or the other, i.e. `N` would
> mean "use the normal, existing, production C one"; while `Y` would
> replace it with the Rust reference driver.

I see.

>> If a module selects CONFIG_AX88796B_PHY, then we need
>> CONFIG_AX88796B_C_PHY or CONFIG_AX88796B_RUST_PHY.
> 
> Are you talking about the inner one perhaps? What I meant is that
> `obj-$(CONFIG_AX88796B_PHY)` expands to `obj-` if
> `CONFIG_AX88796B_PHY` is not defined, so it already does the job of
> the outer `ifdef`, right?

Ah, would work, I guess.

Something simpler like the following might work.

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 107880d13d21..e4d941f0ebe4 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -107,6 +107,13 @@ config AX88796B_PHY
 	  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
+	default n
+	help
+	  Uses the Rust version driver for Asix PHYs.
+
 config BROADCOM_PHY
 	tristate "Broadcom 54XX PHYs"
 	select BCM_NET_PHYLIB
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index c945ed9bd14b..58d7dfb095ab 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -41,7 +41,11 @@ aquantia-objs			+= aquantia_hwmon.o
 endif
 obj-$(CONFIG_AQUANTIA_PHY)	+= aquantia.o
 obj-$(CONFIG_AT803X_PHY)	+= at803x.o
-obj-$(CONFIG_AX88796B_PHY)	+= ax88796b.o
+ifdef CONFIG_AX88796B_RUST_PHY
+  obj-$(CONFIG_AX88796B_PHY)	+= ax88796b_rust.o
+else
+  obj-$(CONFIG_AX88796B_PHY)	+= ax88796b.o
+endif
 obj-$(CONFIG_BCM54140_PHY)	+= bcm54140.o
 obj-$(CONFIG_BCM63XX_PHY)	+= bcm63xx.o
 obj-$(CONFIG_BCM7XXX_PHY)	+= bcm7xxx.o

  reply	other threads:[~2023-09-24 11:02 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-24  6:48 [RFC PATCH v2 0/3] Rust abstractions for network PHY drivers FUJITA Tomonori
2023-09-24  6:49 ` [RFC PATCH v2 1/3] rust: core " FUJITA Tomonori
2023-09-24 12:56   ` Wedson Almeida Filho
2023-09-24 13:39     ` Benno Lossin
2023-09-24 13:51       ` Wedson Almeida Filho
2023-09-25 11:30       ` FUJITA Tomonori
2023-09-25 13:14         ` Andrew Lunn
2023-09-24 15:42     ` Andrew Lunn
2023-09-25  1:13       ` FUJITA Tomonori
2023-09-25 13:25         ` Andrew Lunn
2023-09-25  6:47     ` Alice Ryhl
2023-09-26  1:19     ` FUJITA Tomonori
2023-09-26  2:50       ` Andrew Lunn
2023-09-24 13:19   ` Benno Lossin
2023-09-25 10:24     ` FUJITA Tomonori
2023-09-25 15:41       ` Miguel Ojeda
2023-09-26 13:46         ` FUJITA Tomonori
2023-09-27 10:49           ` Miguel Ojeda
2023-09-27 11:19             ` FUJITA Tomonori
2023-10-09 12:28               ` Miguel Ojeda
2023-09-24 17:00   ` Andrew Lunn
2023-09-24 18:03     ` Miguel Ojeda
2023-09-25 13:28       ` Andrew Lunn
2023-09-25 13:43       ` Andrew Lunn
2023-09-25 15:42         ` Miguel Ojeda
2023-09-25 16:53           ` Andrew Lunn
2023-09-25 17:26             ` Miguel Ojeda
2023-09-25 18:32   ` Andrew Lunn
2023-09-25 19:15     ` Miguel Ojeda
2023-09-26  6:05   ` Trevor Gross
2023-09-26 12:11     ` Andrew Lunn
2023-09-27  3:26     ` FUJITA Tomonori
2023-09-26  6:54   ` Trevor Gross
2023-09-27  3:39     ` FUJITA Tomonori
2023-09-27 12:21       ` Andrew Lunn
2023-09-24  6:49 ` [RFC PATCH v2 2/3] MAINTAINERS: add Rust PHY abstractions file to the ETHERNET PHY LIBRARY FUJITA Tomonori
2023-09-24  6:49 ` [RFC PATCH v2 3/3] net: phy: add Rust Asix PHY driver FUJITA Tomonori
2023-09-24  8:05   ` Miguel Ojeda
2023-09-24  9:38     ` FUJITA Tomonori
2023-09-24 10:10       ` Miguel Ojeda
2023-09-24 11:00         ` FUJITA Tomonori [this message]
2023-09-24 13:33   ` Benno Lossin
2023-09-25  2:31     ` FUJITA Tomonori
2023-09-26  6:20   ` Trevor Gross
2023-09-26  7:07     ` FUJITA Tomonori
     [not found]       ` <CALNs47uYnQC+AXbJuk8d5506D25SDhZ-ZKuhimFkZnYOhhdfCg@mail.gmail.com>
2023-09-26 12:36         ` Andrew Lunn
2023-09-27  1:18         ` FUJITA Tomonori

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=20230924.200056.171141856238500181.fujita.tomonori@gmail.com \
    --to=fujita.tomonori@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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).