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

Remove `use core::ffi::c_void`, which shadows `kernel::ffi::c_void`
brought in via `use crate::prelude::*`, to maintain consistency and
centralize the 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.

Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Jesung Yang <y.j3ms.n@gmail.com>
Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089/topic/x/near/520452733
---
Changes in v3:
- Rebase on a3b2347343e0
- Remove the explicit import of `kernel::ffi::c_void`
- Reword the commit message accordingly
- Link to v2: https://lore.kernel.org/rust-for-linux/20250528155147.2793921-1-y.j3ms.n@gmail.com/

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
index 4b8cdcb21e77..603330f247c7 100644
--- a/rust/kernel/kunit.rs
+++ b/rust/kernel/kunit.rs
@@ -7,7 +7,7 @@
 //! Reference: <https://docs.kernel.org/dev-tools/kunit/index.html>
 
 use crate::prelude::*;
-use core::{ffi::c_void, fmt};
+use core::fmt;
 
 /// Prints a KUnit error-level message.
 ///

base-commit: a3b2347343e077e81d3c169f32c9b2cb1364f4cc
-- 
2.39.5


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

* Re: [PATCH v3] rust: kunit: use crate-level mapping for `c_void`
  2025-05-28 17:49 [PATCH v3] rust: kunit: use crate-level mapping for `c_void` Jesung Yang
@ 2025-05-29 12:53 ` Miguel Ojeda
  2025-06-23 23:12 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2025-05-29 12:53 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, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	linux-kselftest, kunit-dev, rust-for-linux, linux-kernel

On Wed, May 28, 2025 at 7:51 PM Jesung Yang <y.j3ms.n@gmail.com> wrote:
>
> Remove `use core::ffi::c_void`, which shadows `kernel::ffi::c_void`
> brought in via `use crate::prelude::*`, to maintain consistency and
> centralize the 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.
>
> Reviewed-by: Benno Lossin <lossin@kernel.org>
> Signed-off-by: Jesung Yang <y.j3ms.n@gmail.com>
> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089/topic/x/near/520452733

Looks good to me, thanks! If KUnit picks this next cycle:

Acked-by: Miguel Ojeda <ojeda@kernel.org>

Otherwise, I am happy to take it too.

Cheers,
Miguel

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

* Re: [PATCH v3] rust: kunit: use crate-level mapping for `c_void`
  2025-05-28 17:49 [PATCH v3] rust: kunit: use crate-level mapping for `c_void` Jesung Yang
  2025-05-29 12:53 ` Miguel Ojeda
@ 2025-06-23 23:12 ` Miguel Ojeda
  1 sibling, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2025-06-23 23:12 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, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	linux-kselftest, kunit-dev, rust-for-linux, linux-kernel

On Wed, May 28, 2025 at 7:51 PM Jesung Yang <y.j3ms.n@gmail.com> wrote:
>
> Remove `use core::ffi::c_void`, which shadows `kernel::ffi::c_void`
> brought in via `use crate::prelude::*`, to maintain consistency and
> centralize the 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.
>
> Reviewed-by: Benno Lossin <lossin@kernel.org>
> Signed-off-by: Jesung Yang <y.j3ms.n@gmail.com>
> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089/topic/x/near/520452733

Applied to `rust-next` -- thanks everyone!

Cheers,
Miguel

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

end of thread, other threads:[~2025-06-23 23:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 17:49 [PATCH v3] rust: kunit: use crate-level mapping for `c_void` Jesung Yang
2025-05-29 12:53 ` Miguel Ojeda
2025-06-23 23:12 ` Miguel Ojeda

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).