[PATCH 0/4] Introduce import_ns support for Rust

Uwe Kleine-König ukleinek at kernel.org
Wed Oct 29 03:04:12 PDT 2025


Hello,

On Tue, Oct 28, 2025 at 01:22:31PM +0100, Michal Wilczynski wrote:
> This series addresses build warnings reported by `modpost` for the Rust
> PWM driver (`pwm_th1520`) in linux-next:
> 
> WARNING: modpost: module pwm_th1520 uses symbol pwmchip_release from
> namespace PWM, but does not import it.
> 
> These warnings occur because Rust modules, like C modules, need to
> declare their dependencies on C symbols exported to specific namespaces
> (using `EXPORT_SYMBOL_NS` in C). This is done by embedding
> "import_ns=<NAMESPACE>" tags into the module's `.modinfo` section, which
> `modpost` verifies.  The C macro `MODULE_IMPORT_NS()` handles this, but
> the Rust `module!` macro lacked equivalent functionality.
> 
> This series introduces the necessary support:
> 
> Patch 1 extends the core `module!` macro in `rust/macros/module.rs`
> to parse an optional `imports_ns: [...]` field and generate the required
> `import_ns` tags in the `.modinfo` section.
> 
> Patch 2 adds a convenience macro `module_pwm_platform_driver!` to
> `rust/kernel/pwm.rs`. This macro wraps the standard
> `module_platform_driver!` and automatically adds `imports_ns: ["PWM"]`,
> simplifying module declaration for PWM driver authors.
> 
> Patch 3 updates the `pwm_th1520` driver to use the new helper macro,
> fixing the build warnings.

Given that for now the pwm_th1520 driver is the only user, does it make
sense to merge this series via my pwm tree? If it goes via a different
tree, I'd like to have a tag to merge into my tree to hand over code
which is free of warnings to Linus in the next merge window.

> Patch 4 includes a minor clippy style fix for the `pwm_th1520` driver.

If you could mention the command that makes this warning visible, I'd be
glad to add that to my repertoire of build checks.

Thanks for addressing the issue
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20251029/904b6cf1/attachment.sig>


More information about the linux-riscv mailing list