Re: [PATCH v6 01/10] rust: module: move module types into `module.rs`

From: Gary Guo

Date: Thu Jun 25 2026 - 10:38:09 EST


On Wed Jun 24, 2026 at 4:00 PM BST, Alvin Sun wrote:
> Move `Module`, `InPlaceModule`, `ModuleMetadata` and `ThisModule` from
> `lib.rs` into a new `rust/kernel/module.rs`. Re-export them from `lib.rs`
> to avoid tree-wide changes.
>
> Switch six bus driver registrations from `module.0` to the public
> `ThisModule::as_ptr()` accessor, since the field is no longer visible
> outside the new `module` submodule.
>
> No functional change.
>
> Assisted-by: opencode:glm-5.2
> Acked-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> Signed-off-by: Alvin Sun <alvin.sun@xxxxxxxxx>

Suggested-by: Gary Guo <gary@xxxxxxxxxxx>
Link: https://lore.kernel.org/all/DJFIQPLOVO4T.1K8T0VZM30LDA@xxxxxxxxxxx/
Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

> ---
> rust/kernel/auxiliary.rs | 2 +-
> rust/kernel/i2c.rs | 2 +-
> rust/kernel/lib.rs | 75 +++++-------------------------------------------
> rust/kernel/module.rs | 71 +++++++++++++++++++++++++++++++++++++++++++++
> rust/kernel/net/phy.rs | 6 +++-
> rust/kernel/pci.rs | 2 +-
> rust/kernel/platform.rs | 2 +-
> rust/kernel/usb.rs | 2 +-
> 8 files changed, 88 insertions(+), 74 deletions(-)