rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] rust: kunit: use crate-level mapping for `c_void`
@ 2025-05-28 15:51 Jesung Yang
  2025-05-28 16:31 ` Miguel Ojeda
  0 siblings, 1 reply; 3+ messages in thread
From: Jesung Yang @ 2025-05-28 15:51 UTC (permalink / raw)
  To: Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich
  Cc: linux-kselftest, kunit-dev, rust-for-linux, linux-kernel,
	Jesung Yang

Use `kernel::ffi::c_void` instead of `core::ffi::c_void` for consistency
and to centralize abstraction.

Since `kernel::ffi::c_void` is a straightforward re-export of
`core::ffi::c_void`, both are functionally equivalent. However, using
`kernel::ffi::c_void` improves consistency across the kernel's Rust code
and provides a unified reference point in case the definition ever needs
to change, even if such a change is unlikely.

Signed-off-by: Jesung Yang <y.j3ms.n@gmail.com>
Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089/topic/x/near/520452733
---
So in sum, I believe it's reasonable to keep the diff unchanged... but
I'm happy to adjust if you'd prefer a different approach.
---
Changes in v2:
- Add "Link" tag to the related discussion on Zulip
- Reword the commit message to clarify `kernel::ffi::c_void` is a re-export
- Link to v1: https://lore.kernel.org/rust-for-linux/20250526162429.1114862-1-y.j3ms.n@gmail.com/
---
 rust/kernel/kunit.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
index 81833a687b75..bd6fc712dd79 100644
--- a/rust/kernel/kunit.rs
+++ b/rust/kernel/kunit.rs
@@ -6,7 +6,8 @@
 //!
 //! Reference: <https://docs.kernel.org/dev-tools/kunit/index.html>
 
-use core::{ffi::c_void, fmt};
+use core::fmt;
+use kernel::ffi::c_void;
 
 /// Prints a KUnit error-level message.
 ///

base-commit: f4daa80d6be7d3c55ca72a8e560afc4e21f886aa
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] rust: kunit: use crate-level mapping for `c_void`
  2025-05-28 15:51 [PATCH v2] rust: kunit: use crate-level mapping for `c_void` Jesung Yang
@ 2025-05-28 16:31 ` Miguel Ojeda
  2025-05-28 16:42   ` JS Y
  0 siblings, 1 reply; 3+ messages in thread
From: Miguel Ojeda @ 2025-05-28 16:31 UTC (permalink / raw)
  To: Jesung Yang
  Cc: Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-kselftest,
	kunit-dev, rust-for-linux, linux-kernel

On Wed, May 28, 2025 at 5:55 PM Jesung Yang <y.j3ms.n@gmail.com> wrote:
>
> So in sum, I believe it's reasonable to keep the diff unchanged... but
> I'm happy to adjust if you'd prefer a different approach.

I see this is based on rust-next -- if you rebase the patch on top of
the latest one, you will see the prelude there :)

Thanks!

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] rust: kunit: use crate-level mapping for `c_void`
  2025-05-28 16:31 ` Miguel Ojeda
@ 2025-05-28 16:42   ` JS Y
  0 siblings, 0 replies; 3+ messages in thread
From: JS Y @ 2025-05-28 16:42 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Brendan Higgins, David Gow, Rae Moar, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-kselftest,
	kunit-dev, rust-for-linux, linux-kernel

On Thu, May 29, 2025 at 1:31 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> I see this is based on rust-next -- if you rebase the patch on top of
> the latest one, you will see the prelude there :)

Thanks for the heads up! I'll rebase and send out v3 accordingly.

Best regards,
Jesung

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-28 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 15:51 [PATCH v2] rust: kunit: use crate-level mapping for `c_void` Jesung Yang
2025-05-28 16:31 ` Miguel Ojeda
2025-05-28 16:42   ` JS Y

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).