[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251028-pwm_fixes-v1-0-25a532d31998@samsung.com>
Date: Tue, 28 Oct 2025 13:22:31 +0100
From: Michal Wilczynski <m.wilczynski@...sung.com>
To: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin
<lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl
<aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich
<dakr@...nel.org>, Michal Wilczynski <m.wilczynski@...sung.com>, Drew
Fustini <fustini@...nel.org>, Guo Ren <guoren@...nel.org>, Fu Wei
<wefu@...hat.com>, Uwe Kleine-König <ukleinek@...nel.org>
Cc: Stephen Rothwell <sfr@...b.auug.org.au>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org,
linux-riscv@...ts.infradead.org
Subject: [PATCH 0/4] Introduce import_ns support for Rust
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.
Patch 4 includes a minor clippy style fix for the `pwm_th1520` driver.
Thanks to Stephen Rothwell for reporting the build warnings.
---
Michal Wilczynski (4):
rust: macros: Add support for 'imports_ns' to module!
rust: pwm: Add module_pwm_platform_driver! macro
pwm: th1520: Use module_pwm_platform_driver! macro
pwm: th1520: Fix clippy warning for redundant struct field init
drivers/pwm/pwm_th1520.rs | 4 ++--
rust/kernel/pwm.rs | 23 +++++++++++++++++++++++
rust/macros/module.rs | 8 ++++++++
3 files changed, 33 insertions(+), 2 deletions(-)
---
base-commit: cb6649f6217c0331b885cf787f1d175963e2a1d2
change-id: 20251028-pwm_fixes-cca9db267458
prerequisite-message-id: 20251016-rust-next-pwm-working-fan-for-sending-v16-0-a5df2405d2bd@...sung.com
prerequisite-patch-id: bddf445f74431c647c134eabb3eb029374455a2e
prerequisite-patch-id: 6fbf1d04b8ca1c72362d7f3a4e420be8f95a44a8
prerequisite-patch-id: d4adae5b56cd13089bfa070bc4bd3bbc6f50b097
prerequisite-patch-id: c1a631eb7a5d8f1d8dfdae847e8b32e8d5ea95d8
prerequisite-patch-id: 6c2a0d316d9d0aa99346cb12afe4b9dc5ac217db
prerequisite-patch-id: 4a05412207606f8df51db0068c4f57785b02a271
prerequisite-patch-id: e0a0d54562e883b07cbe9c5b3721687de5b4ea55
Best regards,
--
Michal Wilczynski <m.wilczynski@...sung.com>
Powered by blists - more mailing lists