Re: [PATCH net-next v9 2/4] rust: net::phy add module_phy_driver macro
From: "Jarkko Sakkinen" <jarkko@kernel.org>
Date: 2023-12-05 01:48:36
Also in:
rust-for-linux
On Tue Dec 5, 2023 at 3:14 AM EET, FUJITA Tomonori wrote:
quoted hunk ↗ jump to hunk
This macro creates an array of kernel's `struct phy_driver` and registers it. This also corresponds to the kernel's `MODULE_DEVICE_TABLE` macro, which embeds the information for module loading into the module binary file. A PHY driver should use this macro. Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> --- rust/kernel/net/phy.rs | 146 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+)diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs index 5d220187eec9..d9cec139324a 100644 --- a/rust/kernel/net/phy.rs +++ b/rust/kernel/net/phy.rs@@ -752,3 +752,149 @@ const fn as_int(&self) -> u32 { } } } + +/// Declares a kernel module for PHYs drivers. +/// +/// This creates a static array of kernel's `struct phy_driver` and registers it.
s/This creates a static array/Creates a static array/ Suggestion for better formulation: "Creates a static array of `struct phy driver` instances, and registers them.""
+/// This also corresponds to the kernel's `MODULE_DEVICE_TABLE` macro, which embeds the information +/// for module loading into the module binary file. Every driver needs an entry in `device_table`.
s/This/`kernel::module_phy_driver`/ Or at least I did not see it introduced earlier in the text. BR, Jarkko