diff options
| author | Michal Wilczynski <m.wilczynski@samsung.com> | 2025-10-28 13:22:32 +0100 |
|---|---|---|
| committer | Uwe Kleine-König <ukleinek@kernel.org> | 2025-11-07 10:01:53 +0100 |
| commit | 739ad9be61e5f53dbd8d7d7e80723d0799ff077c (patch) | |
| tree | b41e070e286c7dff09a3964d14bdaf80c9fb390c /rust/helpers/pwm.c | |
| parent | 3a8660878839faadb4f1a6dd72c3179c1df56787 (diff) | |
rust: macros: Add support for 'imports_ns' to module!
Kernel modules that use C symbols exported via `EXPORT_SYMBOL_NS` must
declare this dependency for `modpost` verification. C modules achieve
this by using the `MODULE_IMPORT_NS(NAMESPACE)` macro, which embeds an
`import_ns=<NAMESPACE>` tag into the `.modinfo` section.
The Rust `module!` macro lacked the ability to generate these tags,
resulting in build warnings for Rust drivers (like the PWM driver) that
call namespaced C functions.
Modify the `module!` macro's internal parser (`ModuleInfo`) to accept a
new optional field `imports_ns`, which takes an array of namespace
strings. Update the code generator (`ModInfoBuilder::emit`) loop to
iterate over these strings and emit the corresponding
`import_ns=<NAMESPACE>` tags into the `.modinfo` section using the
existing `#[link_section]` mechanism.
This provides the necessary infrastructure for Rust modules to correctly
declare their C namespace dependencies.
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Elle Rhumsaa <elle@weathered-steel.dev>
Acked-by: Daniel Gomez <da.gomez@samsung.com>
Link: https://patch.msgid.link/20251028-pwm_fixes-v1-1-25a532d31998@samsung.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Diffstat (limited to 'rust/helpers/pwm.c')
0 files changed, 0 insertions, 0 deletions
