Re: [PATCH v3 1/6] rust: module: add `THIS_MODULE` const to `ModuleMetadata` trait
Andreas Hindborg <[email protected]>
| Newsgroups | org.kernel.vger.linux-modules,dev.linux.lists.driver-core,dev.linux.lists.nova-gpu,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
Alvin Sun <[email protected]> writes: > Since `const_refs_to_static` has been stable as of the MSRV bump, a > `ThisModule` pointer can now be used in const contexts. > > Add a `THIS_MODULE` const to the `ModuleMetadata` trait so that modules > can provide their `ThisModule` pointer in const contexts such as static > `file_operations`. > > Move the `THIS_MODULE` static from the `module!` macro into the > `ModuleMetadata` impl, add a `this_module()` helper, and update `__init` > to use it. > > Signed-off-by: Alvin Sun <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Best regards, Andreas Hindborg