All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Michal Wilczynski <m.wilczynski@samsung.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Drew Fustini" <fustini@kernel.org>,
	"Guo Ren" <guoren@kernel.org>, "Fu Wei" <wefu@redhat.com>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH 1/4] rust: macros: Add support for 'imports_ns' to module!
Date: Wed, 29 Oct 2025 12:47:09 +0000	[thread overview]
Message-ID: <aQIMzXnUqjW_IVdb@google.com> (raw)
In-Reply-To: <20251028-pwm_fixes-v1-1-25a532d31998@samsung.com>

On Tue, Oct 28, 2025 at 01:22:32PM +0100, Michal Wilczynski wrote:
> 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>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

WARNING: multiple messages have this Message-ID (diff)
From: Alice Ryhl <aliceryhl@google.com>
To: Michal Wilczynski <m.wilczynski@samsung.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Drew Fustini" <fustini@kernel.org>,
	"Guo Ren" <guoren@kernel.org>, "Fu Wei" <wefu@redhat.com>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pwm@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH 1/4] rust: macros: Add support for 'imports_ns' to module!
Date: Wed, 29 Oct 2025 12:47:09 +0000	[thread overview]
Message-ID: <aQIMzXnUqjW_IVdb@google.com> (raw)
In-Reply-To: <20251028-pwm_fixes-v1-1-25a532d31998@samsung.com>

On Tue, Oct 28, 2025 at 01:22:32PM +0100, Michal Wilczynski wrote:
> 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>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2025-10-29 12:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20251028122315eucas1p159b65037cf6f3f710c1917e2464399b5@eucas1p1.samsung.com>
2025-10-28 12:22 ` [PATCH 0/4] Introduce import_ns support for Rust Michal Wilczynski
2025-10-28 12:22   ` Michal Wilczynski
2025-10-28 12:22   ` [PATCH 1/4] rust: macros: Add support for 'imports_ns' to module! Michal Wilczynski
2025-10-28 12:22     ` Michal Wilczynski
2025-10-28 22:32     ` Elle Rhumsaa
2025-10-28 22:32       ` Elle Rhumsaa
2025-10-29 12:47     ` Alice Ryhl [this message]
2025-10-29 12:47       ` Alice Ryhl
2025-10-31  7:47     ` Uwe Kleine-König
2025-10-31  7:47       ` Uwe Kleine-König
2025-10-31 12:57       ` Miguel Ojeda
2025-10-31 12:57         ` Miguel Ojeda
2025-10-31 13:12         ` Daniel Gomez
2025-10-31 13:12           ` Daniel Gomez
2025-11-01  8:06           ` Uwe Kleine-König
2025-11-01  8:06             ` Uwe Kleine-König
2025-10-28 12:22   ` [PATCH 2/4] rust: pwm: Add module_pwm_platform_driver! macro Michal Wilczynski
2025-10-28 12:22     ` Michal Wilczynski
2025-10-28 22:32     ` Elle Rhumsaa
2025-10-28 22:32       ` Elle Rhumsaa
2025-10-28 12:22   ` [PATCH 3/4] pwm: th1520: Use " Michal Wilczynski
2025-10-28 12:22     ` Michal Wilczynski
2025-10-28 22:33     ` Elle Rhumsaa
2025-10-28 22:33       ` Elle Rhumsaa
2025-10-29  0:59     ` Troy Mitchell
2025-10-29  0:59       ` Troy Mitchell
2025-10-28 12:22   ` [PATCH 4/4] pwm: th1520: Fix clippy warning for redundant struct field init Michal Wilczynski
2025-10-28 12:22     ` Michal Wilczynski
2025-10-28 22:33     ` Elle Rhumsaa
2025-10-28 22:33       ` Elle Rhumsaa
2025-10-30 22:05     ` Uwe Kleine-König
2025-10-30 22:05       ` Uwe Kleine-König
2025-10-29 10:04   ` [PATCH 0/4] Introduce import_ns support for Rust Uwe Kleine-König
2025-10-29 10:04     ` Uwe Kleine-König
2025-10-29 11:07     ` Michal Wilczynski
2025-10-29 11:07       ` Michal Wilczynski
2025-10-29 18:18     ` Miguel Ojeda
2025-10-29 18:18       ` Miguel Ojeda
2025-10-29 18:51       ` Michal Wilczynski
2025-10-29 18:51         ` Michal Wilczynski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aQIMzXnUqjW_IVdb@google.com \
    --to=aliceryhl@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=fustini@kernel.org \
    --cc=gary@garyguo.net \
    --cc=guoren@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lossin@kernel.org \
    --cc=m.wilczynski@samsung.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tmgross@umich.edu \
    --cc=ukleinek@kernel.org \
    --cc=wefu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.