Re: [PATCH 2/8] rust: driver: make `DriverModule` struct pub(crate) in `module_driver!`

From: Alvin Sun

Date: Thu May 21 2026 - 04:00:02 EST



On 5/19/26 19:53, Gary Guo wrote:
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.

I misread it — I've already used LocalModule directly in v2.

Best regards,
Alvin


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>>,
}