Re: [PATCH 2/8] rust: driver: make `DriverModule` struct pub(crate) in `module_driver!`
From: Gary Guo
Date: Tue May 19 2026 - 07:57:22 EST
On Tue May 19, 2026 at 7:26 AM BST, Alvin Sun wrote:
> Expose the generated `DriverModule` struct as `pub(crate)` so that
> driver implementations can reference it via `super::DriverModule`
> for the `ThisModule` associated type.
Why is this needed? Child modules can see items super modules.
Best,
Gary
>
> Signed-off-by: Alvin Sun <alvin.sun@xxxxxxxxx>
> ---
> rust/kernel/driver.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs
> index 36de8098754d0..9c7c69c4d2af0 100644
> --- a/rust/kernel/driver.rs
> +++ b/rust/kernel/driver.rs
> @@ -253,7 +253,7 @@ macro_rules! module_driver {
> type Ops<$gen_type> = $driver_ops;
>
> #[$crate::prelude::pin_data]
> - struct DriverModule {
> + pub(crate) struct DriverModule {
> #[pin]
> _driver: $crate::driver::Registration<Ops<$type>>,
> }