[PATCH 0/4] Introduce import_ns support for Rust
Michal Wilczynski
m.wilczynski at samsung.com
Wed Oct 29 04:07:43 PDT 2025
On 10/29/25 11:04, Uwe Kleine-König wrote:
> 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.
Hi,
I agree with you. Hopefully we can get an ack from the Rust maintainers
and the series can go through your tree.
>
>> 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.
I'm using the following command to compile the kernel:
$ make ARCH=riscv -j20 LLVM=1 CLIPPY=1
I guess you were missing the 'CLIPPY=1' part.
>
> Thanks for addressing the issue
> Uwe
Best regards,
--
Michal Wilczynski <m.wilczynski at samsung.com>
More information about the linux-riscv
mailing list