summaryrefslogtreecommitdiff
path: root/rust/kernel/list/impl_list_item_mod.rs
diff options
context:
space:
mode:
authorAlice Ryhl <aliceryhl@google.com>2025-06-24 15:27:56 +0000
committerMiguel Ojeda <ojeda@kernel.org>2025-07-15 22:26:11 +0200
commit64fb810bce03a4e2b4d3ecbba04bb97da3536dd8 (patch)
tree27460a5c5ced40f83ee251579b6bd518d8dcc4f8 /rust/kernel/list/impl_list_item_mod.rs
parent8802e168437840ea0b1d5ca571cd3e95681e9e2b (diff)
rust: types: rename Opaque::raw_get to cast_into
In the previous patch we added Opaque::cast_from() that performs the opposite operation to Opaque::raw_get(). For consistency with this naming, rename raw_get() to cast_from(). There are a few other options such as calling cast_from() something closer to raw_get() rather than renaming this method. However, I could not find a great naming scheme that works with raw_get(). The previous version of this patch used from_raw(), but functions of that name typically have a different signature, so that's not a great option. Suggested-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Acked-by: Benno Lossin <lossin@kernel.org> Acked-by: Andreas Hindborg <a.hindborg@kernel.org> Acked-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Danilo Krummrich <dakr@kernel.org> Acked-by: Danilo Krummrich <dakr@kernel.org> Link: https://lore.kernel.org/r/20250624-opaque-from-raw-v2-2-e4da40bdc59c@google.com [ Removed `HrTimer::raw_get` change. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/list/impl_list_item_mod.rs')
-rw-r--r--rust/kernel/list/impl_list_item_mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/rust/kernel/list/impl_list_item_mod.rs b/rust/kernel/list/impl_list_item_mod.rs
index 1f9498c1458f..c1edba0a9501 100644
--- a/rust/kernel/list/impl_list_item_mod.rs
+++ b/rust/kernel/list/impl_list_item_mod.rs
@@ -209,7 +209,7 @@ macro_rules! impl_list_item {
// the pointer stays in bounds of the allocation.
let self_ptr = unsafe { (links_field as *const u8).add(spoff) }
as *const $crate::types::Opaque<*const Self>;
- let cell_inner = $crate::types::Opaque::raw_get(self_ptr);
+ let cell_inner = $crate::types::Opaque::cast_into(self_ptr);
// SAFETY: This value is not accessed in any other places than `prepare_to_insert`,
// `post_remove`, or `view_value`. By the safety requirements of those methods,
@@ -252,7 +252,7 @@ macro_rules! impl_list_item {
// the pointer stays in bounds of the allocation.
let self_ptr = unsafe { (links_field as *const u8).add(spoff) }
as *const ::core::cell::UnsafeCell<*const Self>;
- let cell_inner = ::core::cell::UnsafeCell::raw_get(self_ptr);
+ let cell_inner = ::core::cell::UnsafeCell::cast_into(self_ptr);
// SAFETY: This is not a data race, because the only function that writes to this
// value is `prepare_to_insert`, but by the safety requirements the
// `prepare_to_insert` method may not be called in parallel with `view_value` or