Linux Modules
 help / color / mirror / Atom feed
From: Alvin Sun <alvin.sun@linux.dev>
To: "Gary Guo" <gary@garyguo.net>, "Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Petr Pavlu" <petr.pavlu@suse.com>,
	"Daniel Gomez" <da.gomez@kernel.org>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Aaron Tomlin" <atomlin@atomlin.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Arnd Bergmann" <arnd@arndb.de>
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-modules@vger.kernel.org, driver-core@lists.linux.dev,
	dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev
Subject: Re: [PATCH 2/8] rust: driver: make `DriverModule` struct pub(crate) in `module_driver!`
Date: Thu, 21 May 2026 15:57:31 +0800	[thread overview]
Message-ID: <81013175-0164-4ad4-a4a7-0cab332b695b@linux.dev> (raw)
In-Reply-To: <DIMMSJ6GO6XE.2D3RYBTZ45EW1@garyguo.net>


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@linux.dev>
>> ---
>>   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>>,
>>           }

  reply	other threads:[~2026-05-21  7:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  6:26 [PATCH 0/8] Fix missing fops.owner in Rust DRM/misc abstractions Alvin Sun
2026-05-19  6:26 ` [PATCH 1/8] rust: module: add `MODULE_PTR` const to `ModuleMetadata` trait Alvin Sun
2026-05-19 11:57   ` Gary Guo
2026-05-19  6:26 ` [PATCH 2/8] rust: driver: make `DriverModule` struct pub(crate) in `module_driver!` Alvin Sun
2026-05-19 11:53   ` Gary Guo
2026-05-21  7:57     ` Alvin Sun [this message]
2026-05-19  6:26 ` [PATCH 3/8] rust: drm: add `ThisModule` associated type to `Driver` trait Alvin Sun
2026-05-19 11:58   ` Gary Guo
2026-05-21  7:59     ` Alvin Sun
2026-05-19  6:26 ` [PATCH 4/8] gpu: nova: implement `ThisModule` Alvin Sun
2026-05-19  6:26 ` [PATCH 5/8] gpu: tyr: " Alvin Sun
2026-05-19  6:26 ` [PATCH 6/8] rust: drm: set fops.owner from driver module pointer Alvin Sun
2026-05-19  6:26 ` [PATCH 7/8] rust: miscdevice: add `ThisModule` associated type to `MiscDevice` trait Alvin Sun
2026-05-19  6:26 ` [PATCH 8/8] samples: rust: rust_misc_device: implement `ThisModule` for `RustMiscDevice` Alvin Sun

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=81013175-0164-4ad4-a4a7-0cab332b695b@linux.dev \
    --to=alvin.sun@linux.dev \
    --cc=a.hindborg@kernel.org \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=arnd@arndb.de \
    --cc=atomlin@atomlin.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=da.gomez@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=simona@ffwll.ch \
    --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