[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250307-unique-ref-v5-2-bffeb633277e@pm.me>
Date: Fri, 07 Mar 2025 10:04:16 +0000
From: Oliver Mangold <oliver.mangold@...me>
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 <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Asahi Lina <lina@...hilina.net>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org, Oliver Mangold <oliver.mangold@...me>
Subject: [PATCH v5 2/4] rust: make Owned::into_raw() and Owned::from_raw() public
It might be necessary to be used from some drivers
Signed-off-by: Oliver Mangold <oliver.mangold@...me>
---
rust/kernel/types.rs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs
index 0cae5ba6607f0a86d2f0e3494f956f6daad78067..e0ce3646a4d3b70c069322a9b0f25c00265a2af8 100644
--- a/rust/kernel/types.rs
+++ b/rust/kernel/types.rs
@@ -616,7 +616,7 @@ impl<T: Ownable> Owned<T> {
///
/// Callers must ensure that the underlying object is acquired and can be considered owned by
/// Rust.
- pub(crate) unsafe fn from_raw(ptr: NonNull<T>) -> Self {
+ pub unsafe fn from_raw(ptr: NonNull<T>) -> Self {
// INVARIANT: The safety requirements guarantee that the new instance now owns the
// reference.
Self {
@@ -630,8 +630,7 @@ pub(crate) unsafe fn from_raw(ptr: NonNull<T>) -> Self {
/// This function does not actually relinquish ownership of the object.
/// After calling this function, the caller is responsible for ownership previously managed
/// by the `Owned`.
- #[allow(dead_code)]
- pub(crate) fn into_raw(me: Self) -> NonNull<T> {
+ pub fn into_raw(me: Self) -> NonNull<T> {
ManuallyDrop::new(me).ptr
}
}
--
2.48.1
Powered by blists - more mailing lists