* [PATCH v6 00/18] refactor to utilize `&raw [const|mut]`
@ 2025-04-18 1:41 Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 01/18] rust: init: refactor to use `&raw mut` Antonio Hickey
` (18 more replies)
0 siblings, 19 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux
This patch set enables the `raw_ref_op` feature, which became stable
in Rust 1.82.
It then replaces all occurences of `addr_of!(place)` and
`addr_of_mut!(place)` with `&raw const place` and `&raw mut place`.
Finally it adds the previous macros `addr_of!` and `addr_of_mut!` to
the disallowed macros in `.clippy.toml`.
Changes in v6:
- Rebased onto rust-next to refactor new occurences of `addr_of[_mut]!`
and handle the 2 patches from the v5 patchset that were merged.
- Link to v5: https://lore.kernel.org/all/20250320020740.1631171-1-contact@antoniohickey.com/
Changes in v5:
- Fix doctest errors when compiling on the minimum Rust version (1.78)
due to not having the `raw_ref_op` feature enabled for doctests.
- Reword commit messages to more accurately describe the changes.
- Replace unsafe call to `Opaque::raw_get` with pointer casting
in workqueue.
- Fix clippy disallowed macros message for `core::ptr::addr_of`
- Link to v4: https://lore.kernel.org/all/20250316061429.817126-1-contact@antoniohickey.com/
Changes in v4:
- Fix comment typo.
- Fix clippy issues.
- Add more context and link for disallowed macros with clippy.
- Separate the patch replacing of `addr_of[_mut]!` macros with
`&raw [const|mut]` into smaller patches for each section.
(PATCH v3 2/3 -> PATCH v4 2/16 through 15/16)
- Fix email typo.
- Link to v3: https://lore.kernel.org/all/0100019597091f92-cb55b6cd-4d06-4d14-8d9c-1a1314949a00-000000@email.amazonses.com/
Changes in v3:
- Re ordered the patches, so that the patch adding the `addr_of[_mut]!`
macros to the disallowed macros in clippy is applied after replacing
all the instances of `addr_of_[_mut]` with `&raw [const|mut]`.
(moved PATCH v2 2/3 -> PATCH v3 3/3 and PATCH v2 3/3 -> PATCH v3 2/3)
- Link to v2: https://lore.kernel.org/all/0100019592c224ba-0cf38e16-2aa2-459d-99cd-09a463d616d4-000000@email.amazonses.com/
Changes in v2:
- Fix `&raw place` should be `&raw const place`
- Fix email typo
- Link to v1: https://lore.kernel.org/all/010001958dfeacb5-9039aaab-6114-494a-9f1d-f13982091169-000000@email.amazonses.com/
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
Antonio Hickey (18):
rust: init: refactor to use `&raw mut`
rust: list: refactor to use `&raw [const|mut]`
rust: task: remove use of `addr_of!` macro
rust: faux: refactor to use `&raw mut`
rust: kunit: refactor to use `&raw [const|mut]`
rust: workqueue: refactor to use `&raw [const|mut]`
rust: workqueue: replace `raw_get` with pointer cast
rust: rbtree: refactor to use `&raw mut`
rust: net: phy: refactor to use `&raw mut`
rust: sync: arc: refactor to use `&raw const`
rust: jump_label: refactor to use `&raw const`
rust: fs: file: refactor to use `&raw const`
rust: time: hrtimer: refactor to use `&raw const`
rust: pci: refactor to use `&raw mut`
rust: platform: refactor to use `&raw mut`
rust: dma: refactor to use `&raw [const|mut]`
rust: pin-init: refactor to use `&raw mut`
rust: clippy: disallow `addr_of[_mut]!` macros
.clippy.toml | 4 ++++
rust/kernel/dma.rs | 4 ++--
rust/kernel/faux.rs | 4 ++--
rust/kernel/fs/file.rs | 2 +-
rust/kernel/init.rs | 4 ++--
rust/kernel/jump_label.rs | 4 ++--
rust/kernel/kunit.rs | 8 ++++----
rust/kernel/list.rs | 2 +-
rust/kernel/list/impl_list_item_mod.rs | 6 +++---
rust/kernel/net/phy.rs | 4 ++--
rust/kernel/pci.rs | 8 ++------
rust/kernel/platform.rs | 8 ++------
rust/kernel/rbtree.rs | 22 ++++++++++----------
rust/kernel/sync/arc.rs | 4 ++--
rust/kernel/task.rs | 4 ++--
rust/kernel/time/hrtimer.rs | 4 ++--
rust/kernel/workqueue.rs | 9 +++------
rust/pin-init/README.md | 3 +--
rust/pin-init/src/lib.rs | 7 +++----
rust/pin-init/src/macros.rs | 28 +++++++++++++-------------
20 files changed, 65 insertions(+), 74 deletions(-)
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v6 01/18] rust: init: refactor to use `&raw mut`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-21 20:20 ` Benno Lossin
2025-04-18 1:41 ` [PATCH v6 02/18] rust: list: refactor to use `&raw [const|mut]` Antonio Hickey
` (17 subsequent siblings)
18 siblings, 1 reply; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of_mut!(place)`
with `&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw mut` is similar to `&mut`
making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/init.rs | 4 ++--
rust/pin-init/src/macros.rs | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 8d228c237954..5646b1079776 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -69,7 +69,7 @@
//! ```rust,ignore
//! # #![allow(unreachable_pub, clippy::disallowed_names)]
//! use kernel::{prelude::*, types::Opaque};
-//! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
+//! use core::{marker::PhantomPinned, pin::Pin};
//! # mod bindings {
//! # #![allow(non_camel_case_types)]
//! # pub struct foo;
@@ -105,7 +105,7 @@
//! unsafe {
//! pin_init::pin_init_from_closure(move |slot: *mut Self| {
//! // `slot` contains uninit memory, avoid creating a reference.
-//! let foo = addr_of_mut!((*slot).foo);
+//! let foo = &raw mut (*slot).foo;
//!
//! // Initialize the `foo`
//! bindings::init_foo(Opaque::raw_get(foo));
diff --git a/rust/pin-init/src/macros.rs b/rust/pin-init/src/macros.rs
index 361623324d5c..28a91a1e1218 100644
--- a/rust/pin-init/src/macros.rs
+++ b/rust/pin-init/src/macros.rs
@@ -244,7 +244,7 @@
//! struct __InitOk;
//! // This is the expansion of `t,`, which is syntactic sugar for `t: t,`.
//! {
-//! unsafe { ::core::ptr::write(::core::addr_of_mut!((*slot).t), t) };
+//! unsafe { ::core::ptr::write(&raw mut (*slot).t, t) };
//! }
//! // Since initialization could fail later (not in this case, since the
//! // error type is `Infallible`) we will need to drop this field if there
@@ -258,7 +258,7 @@
//! // of the `unsafe` block, so we bind it here.
//! {
//! let x = 0;
-//! unsafe { ::core::ptr::write(::core::addr_of_mut!((*slot).x), x) };
+//! unsafe { ::core::ptr::write(&raw mut (*slot).x, x) };
//! }
//! // We again create a `DropGuard`.
//! let __x_guard = unsafe {
@@ -459,13 +459,13 @@
//! {
//! struct __InitOk;
//! {
-//! unsafe { ::core::ptr::write(::core::addr_of_mut!((*slot).a), a) };
+//! unsafe { ::core::ptr::write(&raw mut (*slot).a, a) };
//! }
//! let __a_guard = unsafe {
//! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!((*slot).a))
//! };
//! let init = Bar::new(36);
-//! unsafe { data.b(::core::addr_of_mut!((*slot).b), b)? };
+//! unsafe { data.b(&raw mut (*slot).b, b)? };
//! let __b_guard = unsafe {
//! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!((*slot).b))
//! };
@@ -1215,7 +1215,7 @@ fn assert_zeroable<T: $crate::Zeroable>(_: *mut T) {}
// SAFETY: `slot` is valid, because we are inside of an initializer closure, we
// return when an error/panic occurs.
// We also use the `data` to require the correct trait (`Init` or `PinInit`) for `$field`.
- unsafe { $data.$field(::core::ptr::addr_of_mut!((*$slot).$field), init)? };
+ unsafe { $data.$field(&raw mut (*$slot).$field, init)? };
// Create the drop guard:
//
// We rely on macro hygiene to make it impossible for users to access this local variable.
@@ -1277,7 +1277,7 @@ fn assert_zeroable<T: $crate::Zeroable>(_: *mut T) {}
// Initialize the field.
//
// SAFETY: The memory at `slot` is uninitialized.
- unsafe { ::core::ptr::write(::core::ptr::addr_of_mut!((*$slot).$field), $field) };
+ unsafe { ::core::ptr::write(&raw mut (*$slot).$field, $field) };
}
// Create the drop guard:
//
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 02/18] rust: list: refactor to use `&raw [const|mut]`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 01/18] rust: init: refactor to use `&raw mut` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 03/18] rust: task: remove use of `addr_of!` macro Antonio Hickey
` (16 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of!(place)` and `addr_of_mut!(place)`
with `&raw const place` and `&raw mut place` respectively.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const`, `&raw mut` are similar
to `&`, `&mut` making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/list.rs | 2 +-
rust/kernel/list/impl_list_item_mod.rs | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/rust/kernel/list.rs b/rust/kernel/list.rs
index a335c3b1ff5e..b1f504f6b809 100644
--- a/rust/kernel/list.rs
+++ b/rust/kernel/list.rs
@@ -176,7 +176,7 @@ pub fn new() -> impl PinInit<Self> {
#[inline]
unsafe fn fields(me: *mut Self) -> *mut ListLinksFields {
// SAFETY: The caller promises that the pointer is valid.
- unsafe { Opaque::raw_get(ptr::addr_of!((*me).inner)) }
+ unsafe { Opaque::raw_get(&raw const (*me).inner) }
}
/// # Safety
diff --git a/rust/kernel/list/impl_list_item_mod.rs b/rust/kernel/list/impl_list_item_mod.rs
index a0438537cee1..014b6713d59d 100644
--- a/rust/kernel/list/impl_list_item_mod.rs
+++ b/rust/kernel/list/impl_list_item_mod.rs
@@ -49,7 +49,7 @@ macro_rules! impl_has_list_links {
// SAFETY: The implementation of `raw_get_list_links` only compiles if the field has the
// right type.
//
- // The behavior of `raw_get_list_links` is not changed since the `addr_of_mut!` macro is
+ // The behavior of `raw_get_list_links` is not changed since the `&raw mut` op is
// equivalent to the pointer offset operation in the trait definition.
unsafe impl$(<$($implarg),*>)? $crate::list::HasListLinks$(<$id>)? for
$self $(<$($selfarg),*>)?
@@ -61,7 +61,7 @@ unsafe fn raw_get_list_links(ptr: *mut Self) -> *mut $crate::list::ListLinks$(<$
// SAFETY: The caller promises that the pointer is not dangling. We know that this
// expression doesn't follow any pointers, as the `offset_of!` invocation above
// would otherwise not compile.
- unsafe { ::core::ptr::addr_of_mut!((*ptr)$(.$field)*) }
+ unsafe { &raw mut (*ptr)$(.$field)* }
}
}
)*};
@@ -103,7 +103,7 @@ macro_rules! impl_has_list_links_self_ptr {
unsafe fn raw_get_list_links(ptr: *mut Self) -> *mut $crate::list::ListLinks$(<$id>)? {
// SAFETY: The caller promises that the pointer is not dangling.
let ptr: *mut $crate::list::ListLinksSelfPtr<$item_type $(, $id)?> =
- unsafe { ::core::ptr::addr_of_mut!((*ptr).$field) };
+ unsafe { &raw mut (*ptr).$field };
ptr.cast()
}
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 03/18] rust: task: remove use of `addr_of!` macro
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 01/18] rust: init: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 02/18] rust: list: refactor to use `&raw [const|mut]` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 04/18] rust: faux: refactor to use `&raw mut` Antonio Hickey
` (15 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
The use of `addr_of!` here is unnecessary since its immediately
dereferenced. The main benefit of `addr_of!` is to avoid intermediate
field loads without immediate dereferencing, so there's no benefit in
using it here.
We can achieve the same behavior by directly accessing the
`group_leader` and `pid` fields, which is more idiomatic.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/task.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs
index 9e6f6854948d..554b42c609af 100644
--- a/rust/kernel/task.rs
+++ b/rust/kernel/task.rs
@@ -259,7 +259,7 @@ pub fn as_ptr(&self) -> *mut bindings::task_struct {
pub fn group_leader(&self) -> &Task {
// SAFETY: The group leader of a task never changes after initialization, so reading this
// field is not a data race.
- let ptr = unsafe { *ptr::addr_of!((*self.as_ptr()).group_leader) };
+ let ptr = unsafe { (*self.as_ptr()).group_leader };
// SAFETY: The lifetime of the returned task reference is tied to the lifetime of `self`,
// and given that a task has a reference to its group leader, we know it must be valid for
@@ -271,7 +271,7 @@ pub fn group_leader(&self) -> &Task {
pub fn pid(&self) -> Pid {
// SAFETY: The pid of a task never changes after initialization, so reading this field is
// not a data race.
- unsafe { *ptr::addr_of!((*self.as_ptr()).pid) }
+ unsafe { (*self.as_ptr()).pid }
}
/// Returns the UID of the given task.
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 04/18] rust: faux: refactor to use `&raw mut`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (2 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 03/18] rust: task: remove use of `addr_of!` macro Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 05/18] rust: kunit: refactor to use `&raw [const|mut]` Antonio Hickey
` (14 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of_mut!(place)`
with `&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw mut` is similar to `&mut`
making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/faux.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/faux.rs b/rust/kernel/faux.rs
index 8a50fcd4c9bb..064b4f60af4e 100644
--- a/rust/kernel/faux.rs
+++ b/rust/kernel/faux.rs
@@ -7,7 +7,7 @@
//! C header: [`include/linux/device/faux.h`]
use crate::{bindings, device, error::code::*, prelude::*};
-use core::ptr::{addr_of_mut, null, null_mut, NonNull};
+use core::ptr::{null, null_mut, NonNull};
/// The registration of a faux device.
///
@@ -54,7 +54,7 @@ impl AsRef<device::Device> for Registration {
fn as_ref(&self) -> &device::Device {
// SAFETY: The underlying `device` in `faux_device` is guaranteed by the C API to be
// a valid initialized `device`.
- unsafe { device::Device::as_ref(addr_of_mut!((*self.as_raw()).dev)) }
+ unsafe { device::Device::as_ref(&raw mut (*self.as_raw()).dev) }
}
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 05/18] rust: kunit: refactor to use `&raw [const|mut]`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (3 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 04/18] rust: faux: refactor to use `&raw mut` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 06/18] rust: workqueue: " Antonio Hickey
` (13 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 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: Antonio Hickey, linux-kselftest, kunit-dev, rust-for-linux,
linux-kernel
Replacing all occurrences of `addr_of!(place)` and `addr_of_mut!(place)`
with `&raw const place` and `&raw mut place` respectively.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const`, `&raw mut` are similar
to `&`, `&mut` making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/kunit.rs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
index 1604fb6a5b1b..9f8165b15a37 100644
--- a/rust/kernel/kunit.rs
+++ b/rust/kernel/kunit.rs
@@ -130,9 +130,9 @@ unsafe impl Sync for UnaryAssert {}
unsafe {
$crate::bindings::__kunit_do_failed_assertion(
kunit_test,
- core::ptr::addr_of!(LOCATION.0),
+ &raw const LOCATION.0,
$crate::bindings::kunit_assert_type_KUNIT_ASSERTION,
- core::ptr::addr_of!(ASSERTION.0.assert),
+ &raw const ASSERTION.0.assert,
Some($crate::bindings::kunit_unary_assert_format),
core::ptr::null(),
);
@@ -261,7 +261,7 @@ macro_rules! kunit_unsafe_test_suite {
// (as documented) must be valid for the lifetime of
// the suite (i.e., static).
test_cases: unsafe {
- ::core::ptr::addr_of_mut!($test_cases)
+ (&raw mut $test_cases)
.cast::<::kernel::bindings::kunit_case>()
},
suite_init: None,
@@ -283,7 +283,7 @@ macro_rules! kunit_unsafe_test_suite {
#[cfg_attr(not(target_os = "macos"), link_section = ".kunit_test_suites")]
static mut KUNIT_TEST_SUITE_ENTRY: *const ::kernel::bindings::kunit_suite =
// SAFETY: `KUNIT_TEST_SUITE` is static.
- unsafe { ::core::ptr::addr_of_mut!(KUNIT_TEST_SUITE) };
+ unsafe { &raw mut KUNIT_TEST_SUITE };
};
};
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 06/18] rust: workqueue: refactor to use `&raw [const|mut]`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (4 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 05/18] rust: kunit: refactor to use `&raw [const|mut]` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 07/18] rust: workqueue: replace `raw_get` with pointer cast Antonio Hickey
` (12 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of!(place)` and `addr_of_mut!(place)`
with `&raw const place` and `&raw mut place` respectively.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const`, `&raw mut` are similar
to `&`, `&mut` making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/workqueue.rs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
index f98bd02b838f..3a8e05ac6bd5 100644
--- a/rust/kernel/workqueue.rs
+++ b/rust/kernel/workqueue.rs
@@ -401,9 +401,10 @@ pub fn new(name: &'static CStr, key: Pin<&'static LockClassKey>) -> impl PinInit
pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct {
// SAFETY: The caller promises that the pointer is aligned and not dangling.
//
- // A pointer cast would also be ok due to `#[repr(transparent)]`. We use `addr_of!` so that
- // the compiler does not complain that the `work` field is unused.
- unsafe { Opaque::raw_get(core::ptr::addr_of!((*ptr).work)) }
+ // A pointer cast would also be ok due to `#[repr(transparent)]`. We use
+ // `&raw const (*ptr).work` so that the compiler does not complain that the
+ // `work` field is unused.
+ unsafe { Opaque::raw_get(&raw const (*ptr).work) }
}
}
@@ -510,7 +511,7 @@ macro_rules! impl_has_work {
unsafe fn raw_get_work(ptr: *mut Self) -> *mut $crate::workqueue::Work<$work_type $(, $id)?> {
// SAFETY: The caller promises that the pointer is not dangling.
unsafe {
- ::core::ptr::addr_of_mut!((*ptr).$field)
+ &raw mut (*ptr).$field
}
}
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 07/18] rust: workqueue: replace `raw_get` with pointer cast
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (5 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 06/18] rust: workqueue: " Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 08/18] rust: rbtree: refactor to use `&raw mut` Antonio Hickey
` (11 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Now that `Work` is initialized via `pin-init`, the `work` field
is always used. This allows us to replace the use of unsafe
`Opaque::raw_get` with direct pointer casting.
Suggested-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/all/20250316061429.817126-1-contact@antoniohickey.com/T/#mc7a4757e8c132f84228b728c7d123d73841501d6
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/workqueue.rs | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs
index 3a8e05ac6bd5..c5f09b0682bb 100644
--- a/rust/kernel/workqueue.rs
+++ b/rust/kernel/workqueue.rs
@@ -399,12 +399,8 @@ pub fn new(name: &'static CStr, key: Pin<&'static LockClassKey>) -> impl PinInit
/// need not be initialized.)
#[inline]
pub unsafe fn raw_get(ptr: *const Self) -> *mut bindings::work_struct {
- // SAFETY: The caller promises that the pointer is aligned and not dangling.
- //
- // A pointer cast would also be ok due to `#[repr(transparent)]`. We use
- // `&raw const (*ptr).work` so that the compiler does not complain that the
- // `work` field is unused.
- unsafe { Opaque::raw_get(&raw const (*ptr).work) }
+ // CAST: `Work` is transparent to `bindings::work_struct`.
+ ptr.cast_mut().cast()
}
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 08/18] rust: rbtree: refactor to use `&raw mut`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (6 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 07/18] rust: workqueue: replace `raw_get` with pointer cast Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 09/18] rust: net: phy: " Antonio Hickey
` (10 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of_mut!(place)`
with `&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw mut` is similar to `&mut`
making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/rbtree.rs | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/rust/kernel/rbtree.rs b/rust/kernel/rbtree.rs
index 5246b2c8a4ff..04dbbeb8318d 100644
--- a/rust/kernel/rbtree.rs
+++ b/rust/kernel/rbtree.rs
@@ -11,7 +11,7 @@
cmp::{Ord, Ordering},
marker::PhantomData,
mem::MaybeUninit,
- ptr::{addr_of_mut, from_mut, NonNull},
+ ptr::{from_mut, NonNull},
};
/// A red-black tree with owned nodes.
@@ -238,7 +238,7 @@ pub fn values_mut(&mut self) -> impl Iterator<Item = &'_ mut V> {
/// Returns a cursor over the tree nodes, starting with the smallest key.
pub fn cursor_front(&mut self) -> Option<Cursor<'_, K, V>> {
- let root = addr_of_mut!(self.root);
+ let root = &raw mut self.root;
// SAFETY: `self.root` is always a valid root node
let current = unsafe { bindings::rb_first(root) };
NonNull::new(current).map(|current| {
@@ -253,7 +253,7 @@ pub fn cursor_front(&mut self) -> Option<Cursor<'_, K, V>> {
/// Returns a cursor over the tree nodes, starting with the largest key.
pub fn cursor_back(&mut self) -> Option<Cursor<'_, K, V>> {
- let root = addr_of_mut!(self.root);
+ let root = &raw mut self.root;
// SAFETY: `self.root` is always a valid root node
let current = unsafe { bindings::rb_last(root) };
NonNull::new(current).map(|current| {
@@ -459,7 +459,7 @@ pub fn cursor_lower_bound(&mut self, key: &K) -> Option<Cursor<'_, K, V>>
let best = best_match?;
// SAFETY: `best` is a non-null node so it is valid by the type invariants.
- let links = unsafe { addr_of_mut!((*best.as_ptr()).links) };
+ let links = unsafe { &raw mut (*best.as_ptr()).links };
NonNull::new(links).map(|current| {
// INVARIANT:
@@ -767,7 +767,7 @@ pub fn remove_current(self) -> (Option<Self>, RBTreeNode<K, V>) {
let node = RBTreeNode { node };
// SAFETY: The reference to the tree used to create the cursor outlives the cursor, so
// the tree cannot change. By the tree invariant, all nodes are valid.
- unsafe { bindings::rb_erase(&mut (*this).links, addr_of_mut!(self.tree.root)) };
+ unsafe { bindings::rb_erase(&mut (*this).links, &raw mut self.tree.root) };
let current = match (prev, next) {
(_, Some(next)) => next,
@@ -803,7 +803,7 @@ fn remove_neighbor(&mut self, direction: Direction) -> Option<RBTreeNode<K, V>>
let neighbor = neighbor.as_ptr();
// SAFETY: The reference to the tree used to create the cursor outlives the cursor, so
// the tree cannot change. By the tree invariant, all nodes are valid.
- unsafe { bindings::rb_erase(neighbor, addr_of_mut!(self.tree.root)) };
+ unsafe { bindings::rb_erase(neighbor, &raw mut self.tree.root) };
// SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self`
// point to the links field of `Node<K, V>` objects.
let this = unsafe { container_of!(neighbor, Node<K, V>, links) }.cast_mut();
@@ -918,7 +918,7 @@ unsafe fn to_key_value_raw<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, *mut
let k = unsafe { &(*this).key };
// SAFETY: The passed `node` is the current node or a non-null neighbor,
// thus `this` is valid by the type invariants.
- let v = unsafe { addr_of_mut!((*this).value) };
+ let v = unsafe { &raw mut (*this).value };
(k, v)
}
}
@@ -1027,7 +1027,7 @@ fn next(&mut self) -> Option<Self::Item> {
self.next = unsafe { bindings::rb_next(self.next) };
// SAFETY: By the same reasoning above, it is safe to dereference the node.
- Some(unsafe { (addr_of_mut!((*cur).key), addr_of_mut!((*cur).value)) })
+ Some(unsafe { (&raw mut (*cur).key, &raw mut (*cur).value) })
}
}
@@ -1170,7 +1170,7 @@ fn insert(self, node: RBTreeNode<K, V>) -> &'a mut V {
// SAFETY: `node` is valid at least until we call `KBox::from_raw`, which only happens when
// the node is removed or replaced.
- let node_links = unsafe { addr_of_mut!((*node).links) };
+ let node_links = unsafe { &raw mut (*node).links };
// INVARIANT: We are linking in a new node, which is valid. It remains valid because we
// "forgot" it with `KBox::into_raw`.
@@ -1178,7 +1178,7 @@ fn insert(self, node: RBTreeNode<K, V>) -> &'a mut V {
unsafe { bindings::rb_link_node(node_links, self.parent, self.child_field_of_parent) };
// SAFETY: All pointers are valid. `node` has just been inserted into the tree.
- unsafe { bindings::rb_insert_color(node_links, addr_of_mut!((*self.rbtree).root)) };
+ unsafe { bindings::rb_insert_color(node_links, &raw mut (*self.rbtree).root) };
// SAFETY: The node is valid until we remove it from the tree.
unsafe { &mut (*node).value }
@@ -1261,7 +1261,7 @@ fn replace(self, node: RBTreeNode<K, V>) -> RBTreeNode<K, V> {
// SAFETY: `node` is valid at least until we call `KBox::from_raw`, which only happens when
// the node is removed or replaced.
- let new_node_links = unsafe { addr_of_mut!((*node).links) };
+ let new_node_links = unsafe { &raw mut (*node).links };
// SAFETY: This updates the pointers so that `new_node_links` is in the tree where
// `self.node_links` used to be.
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 09/18] rust: net: phy: refactor to use `&raw mut`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (7 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 08/18] rust: rbtree: refactor to use `&raw mut` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 10/18] rust: sync: arc: refactor to use `&raw const` Antonio Hickey
` (9 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: FUJITA Tomonori, Trevor Gross, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Danilo Krummrich
Cc: Antonio Hickey, netdev, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of_mut!(place)` with
`&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw mut` is similar to `&mut`
making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/net/phy.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index a59469c785e3..757db052cc09 100644
--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -7,7 +7,7 @@
//! C headers: [`include/linux/phy.h`](srctree/include/linux/phy.h).
use crate::{error::*, prelude::*, types::Opaque};
-use core::{marker::PhantomData, ptr::addr_of_mut};
+use core::marker::PhantomData;
pub mod reg;
@@ -285,7 +285,7 @@ impl AsRef<kernel::device::Device> for Device {
fn as_ref(&self) -> &kernel::device::Device {
let phydev = self.0.get();
// SAFETY: The struct invariant ensures that `mdio.dev` is valid.
- unsafe { kernel::device::Device::as_ref(addr_of_mut!((*phydev).mdio.dev)) }
+ unsafe { kernel::device::Device::as_ref(&raw mut (*phydev).mdio.dev) }
}
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 10/18] rust: sync: arc: refactor to use `&raw const`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (8 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 09/18] rust: net: phy: " Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 11/18] rust: jump_label: " Antonio Hickey
` (8 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of!(place)` with
`&raw const place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const` is similar to `&` making
it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/sync/arc.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs
index 8484c814609a..fea85e5342a0 100644
--- a/rust/kernel/sync/arc.rs
+++ b/rust/kernel/sync/arc.rs
@@ -263,7 +263,7 @@ pub fn into_raw(self) -> *const T {
let ptr = self.ptr.as_ptr();
core::mem::forget(self);
// SAFETY: The pointer is valid.
- unsafe { core::ptr::addr_of!((*ptr).data) }
+ unsafe { &raw const (*ptr).data }
}
/// Return a raw pointer to the data in this arc.
@@ -272,7 +272,7 @@ pub fn as_ptr(this: &Self) -> *const T {
// SAFETY: As `ptr` points to a valid allocation of type `ArcInner`,
// field projection to `data`is within bounds of the allocation.
- unsafe { core::ptr::addr_of!((*ptr).data) }
+ unsafe { &raw const (*ptr).data }
}
/// Recreates an [`Arc`] instance previously deconstructed via [`Arc::into_raw`].
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 11/18] rust: jump_label: refactor to use `&raw const`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (9 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 10/18] rust: sync: arc: refactor to use `&raw const` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 12/18] rust: fs: file: " Antonio Hickey
` (7 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of!(place)` with
`&raw const place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const` is similar to `&` making
it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/jump_label.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/jump_label.rs b/rust/kernel/jump_label.rs
index 4e974c768dbd..ca10abae0eee 100644
--- a/rust/kernel/jump_label.rs
+++ b/rust/kernel/jump_label.rs
@@ -20,8 +20,8 @@
#[macro_export]
macro_rules! static_branch_unlikely {
($key:path, $keytyp:ty, $field:ident) => {{
- let _key: *const $keytyp = ::core::ptr::addr_of!($key);
- let _key: *const $crate::bindings::static_key_false = ::core::ptr::addr_of!((*_key).$field);
+ let _key: *const $keytyp = &raw const $key;
+ let _key: *const $crate::bindings::static_key_false = &raw const (*_key).$field;
let _key: *const $crate::bindings::static_key = _key.cast();
#[cfg(not(CONFIG_JUMP_LABEL))]
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 12/18] rust: fs: file: refactor to use `&raw const`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (10 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 11/18] rust: jump_label: " Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 13/18] rust: time: hrtimer: " Antonio Hickey
` (6 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of!(place)` with
`&raw const place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const` is similar to `&` making
it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/fs/file.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rust/kernel/fs/file.rs b/rust/kernel/fs/file.rs
index 13a0e44cd1aa..dc427613654e 100644
--- a/rust/kernel/fs/file.rs
+++ b/rust/kernel/fs/file.rs
@@ -331,7 +331,7 @@ pub fn flags(&self) -> u32 {
// SAFETY: The file is valid because the shared reference guarantees a nonzero refcount.
//
// FIXME(read_once): Replace with `read_once` when available on the Rust side.
- unsafe { core::ptr::addr_of!((*self.as_ptr()).f_flags).read_volatile() }
+ unsafe { (&raw const (*self.as_ptr()).f_flags).read_volatile() }
}
}
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 13/18] rust: time: hrtimer: refactor to use `&raw const`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (11 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 12/18] rust: fs: file: " Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 14/18] rust: pci: refactor to use `&raw mut` Antonio Hickey
` (5 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Andreas Hindborg, Boqun Feng, Frederic Weisbecker, Lyude Paul,
Thomas Gleixner, Anna-Maria Behnsen, Miguel Ojeda, Alex Gaynor,
Gary Guo, Björn Roy Baron, Benno Lossin, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of!(place)` with
`&raw const place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const` is similar to `&` making
it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/time/hrtimer.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/time/hrtimer.rs b/rust/kernel/time/hrtimer.rs
index ce53f8579d18..d91d2a655baf 100644
--- a/rust/kernel/time/hrtimer.rs
+++ b/rust/kernel/time/hrtimer.rs
@@ -132,7 +132,7 @@ unsafe fn raw_get(this: *const Self) -> *mut bindings::hrtimer {
// SAFETY: The field projection to `timer` does not go out of bounds,
// because the caller of this function promises that `this` points to an
// allocation of at least the size of `Self`.
- unsafe { Opaque::raw_get(core::ptr::addr_of!((*this).timer)) }
+ unsafe { Opaque::raw_get(&raw const (*this).timer) }
}
/// Cancel an initialized and potentially running timer.
@@ -494,7 +494,7 @@ unsafe fn raw_get_timer(
this: *const Self,
) -> *const $crate::time::hrtimer::HrTimer<$timer_type> {
// SAFETY: The caller promises that the pointer is not dangling.
- unsafe { ::core::ptr::addr_of!((*this).$field) }
+ unsafe { &raw const (*this).$field }
}
#[inline]
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 14/18] rust: pci: refactor to use `&raw mut`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (12 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 13/18] rust: time: hrtimer: " Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 15/18] rust: platform: " Antonio Hickey
` (4 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Bjorn Helgaas, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, linux-pci, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of_mut!(place)`
with `&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw mut` is similar to `&mut`
making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/pci.rs | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
index c97d6d470b28..4ad82f10a8b3 100644
--- a/rust/kernel/pci.rs
+++ b/rust/kernel/pci.rs
@@ -17,11 +17,7 @@
types::{ARef, ForeignOwnable, Opaque},
ThisModule,
};
-use core::{
- marker::PhantomData,
- ops::Deref,
- ptr::{addr_of_mut, NonNull},
-};
+use core::{marker::PhantomData, ops::Deref, ptr::NonNull};
use kernel::prelude::*;
/// An adapter for the registration of PCI drivers.
@@ -459,7 +455,7 @@ impl AsRef<device::Device> for Device {
fn as_ref(&self) -> &device::Device {
// SAFETY: By the type invariant of `Self`, `self.as_raw()` is a pointer to a valid
// `struct pci_dev`.
- let dev = unsafe { addr_of_mut!((*self.as_raw()).dev) };
+ let dev = unsafe { &raw mut (*self.as_raw()).dev };
// SAFETY: `dev` points to a valid `struct device`.
unsafe { device::Device::as_ref(dev) }
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 15/18] rust: platform: refactor to use `&raw mut`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (13 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 14/18] rust: pci: refactor to use `&raw mut` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 16/18] rust: dma: refactor to use `&raw [const|mut]` Antonio Hickey
` (3 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of_mut!(place)`
with `&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw mut` is similar to `&mut`
making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/platform.rs | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs
index 4917cb34e2fe..f0f316b639e8 100644
--- a/rust/kernel/platform.rs
+++ b/rust/kernel/platform.rs
@@ -14,11 +14,7 @@
ThisModule,
};
-use core::{
- marker::PhantomData,
- ops::Deref,
- ptr::{addr_of_mut, NonNull},
-};
+use core::{marker::PhantomData, ops::Deref, ptr::NonNull};
/// An adapter for the registration of platform drivers.
pub struct Adapter<T: Driver>(T);
@@ -227,7 +223,7 @@ impl AsRef<device::Device> for Device {
fn as_ref(&self) -> &device::Device {
// SAFETY: By the type invariant of `Self`, `self.as_raw()` is a pointer to a valid
// `struct platform_device`.
- let dev = unsafe { addr_of_mut!((*self.as_raw()).dev) };
+ let dev = unsafe { &raw mut (*self.as_raw()).dev };
// SAFETY: `dev` points to a valid `struct device`.
unsafe { device::Device::as_ref(dev) }
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 16/18] rust: dma: refactor to use `&raw [const|mut]`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (14 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 15/18] rust: platform: " Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 17/18] rust: pin-init: refactor to use `&raw mut` Antonio Hickey
` (2 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Abdiel Janulgue, Danilo Krummrich, Daniel Almeida, Robin Murphy,
Andreas Hindborg, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of!(place)` and `addr_of_mut!(place)`
with `&raw const place` and `&raw mut place` respectively.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const`, `&raw mut` are similar
to `&`, `&mut` making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/kernel/dma.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs
index 8cdc76043ee7..8a63c0e83c92 100644
--- a/rust/kernel/dma.rs
+++ b/rust/kernel/dma.rs
@@ -333,7 +333,7 @@ macro_rules! dma_read {
// dereferenced. The compiler also further validates the expression on whether `field`
// is a member of `item` when expanded by the macro.
unsafe {
- let ptr_field = ::core::ptr::addr_of!((*item) $($field)*);
+ let ptr_field = &raw const ((*item) $($field)*);
$crate::dma::CoherentAllocation::field_read(&$dma, ptr_field)
}
}};
@@ -384,7 +384,7 @@ macro_rules! dma_write {
// dereferenced. The compiler also further validates the expression on whether `field`
// is a member of `item` when expanded by the macro.
unsafe {
- let ptr_field = ::core::ptr::addr_of_mut!((*item) $(.$field)*);
+ let ptr_field = &raw mut ((*item) $(.$field)*);
$crate::dma::CoherentAllocation::field_write(&$dma, ptr_field, $val)
}
};
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 17/18] rust: pin-init: refactor to use `&raw mut`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (15 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 16/18] rust: dma: refactor to use `&raw [const|mut]` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 18/18] rust: clippy: disallow `addr_of[_mut]!` macros Antonio Hickey
2025-04-18 13:45 ` [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Miguel Ojeda
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Benno Lossin, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
Replacing all occurrences of `addr_of_mut!(place)`
with `&raw mut place`.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw mut` is similar to `&mut`
making it fit more naturally with other existing code.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
rust/pin-init/README.md | 3 +--
rust/pin-init/src/lib.rs | 7 +++----
rust/pin-init/src/macros.rs | 16 ++++++++--------
3 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/rust/pin-init/README.md b/rust/pin-init/README.md
index 3d04796b212b..1ab4ad0144f3 100644
--- a/rust/pin-init/README.md
+++ b/rust/pin-init/README.md
@@ -142,7 +142,6 @@ actually does the initialization in the correct way. Here are the things to look
```rust
use pin_init::{pin_data, pinned_drop, PinInit, PinnedDrop, pin_init_from_closure};
use core::{
- ptr::addr_of_mut,
marker::PhantomPinned,
cell::UnsafeCell,
pin::Pin,
@@ -181,7 +180,7 @@ impl RawFoo {
unsafe {
pin_init_from_closure(move |slot: *mut Self| {
// `slot` contains uninit memory, avoid creating a reference.
- let foo = addr_of_mut!((*slot).foo);
+ let foo = &raw mut (*slot).foo;
let foo = UnsafeCell::raw_get(foo).cast::<bindings::foo>();
// Initialize the `foo`
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index 05c44514765e..36391738835c 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -166,7 +166,6 @@
//! # #![feature(extern_types)]
//! use pin_init::{pin_data, pinned_drop, PinInit, PinnedDrop, pin_init_from_closure};
//! use core::{
-//! ptr::addr_of_mut,
//! marker::PhantomPinned,
//! cell::UnsafeCell,
//! pin::Pin,
@@ -205,7 +204,7 @@
//! unsafe {
//! pin_init_from_closure(move |slot: *mut Self| {
//! // `slot` contains uninit memory, avoid creating a reference.
-//! let foo = addr_of_mut!((*slot).foo);
+//! let foo = &raw mut (*slot).foo;
//! let foo = UnsafeCell::raw_get(foo).cast::<bindings::foo>();
//!
//! // Initialize the `foo`
@@ -698,7 +697,7 @@ macro_rules! stack_try_pin_init {
///
/// ```rust
/// # use pin_init::*;
-/// # use core::{ptr::addr_of_mut, marker::PhantomPinned};
+/// # use core::marker::PhantomPinned;
/// #[pin_data]
/// #[derive(Zeroable)]
/// struct Buf {
@@ -712,7 +711,7 @@ macro_rules! stack_try_pin_init {
/// let init = pin_init!(&this in Buf {
/// buf: [0; 64],
/// // SAFETY: TODO.
-/// ptr: unsafe { addr_of_mut!((*this.as_ptr()).buf).cast() },
+/// ptr: unsafe { (&raw mut (*this.as_ptr()).buf).cast() },
/// pin: PhantomPinned,
/// });
/// let init = pin_init!(Buf {
diff --git a/rust/pin-init/src/macros.rs b/rust/pin-init/src/macros.rs
index 28a91a1e1218..14ab121443f0 100644
--- a/rust/pin-init/src/macros.rs
+++ b/rust/pin-init/src/macros.rs
@@ -251,7 +251,7 @@
//! // is an error later. This `DropGuard` will drop the field when it gets
//! // dropped and has not yet been forgotten.
//! let __t_guard = unsafe {
-//! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!((*slot).t))
+//! ::pin_init::__internal::DropGuard::new(&raw mut (*slot).t)
//! };
//! // Expansion of `x: 0,`:
//! // Since this can be an arbitrary expression we cannot place it inside
@@ -262,7 +262,7 @@
//! }
//! // We again create a `DropGuard`.
//! let __x_guard = unsafe {
-//! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!((*slot).x))
+//! ::pin_init::__internal::DropGuard::new(&raw mut (*slot).x)
//! };
//! // Since initialization has successfully completed, we can now forget
//! // the guards. This is not `mem::forget`, since we only have
@@ -462,12 +462,12 @@
//! unsafe { ::core::ptr::write(&raw mut (*slot).a, a) };
//! }
//! let __a_guard = unsafe {
-//! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!((*slot).a))
+//! ::pin_init::__internal::DropGuard::new(&raw mut (*slot).a)
//! };
//! let init = Bar::new(36);
//! unsafe { data.b(&raw mut (*slot).b, b)? };
//! let __b_guard = unsafe {
-//! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!((*slot).b))
+//! ::pin_init::__internal::DropGuard::new(&raw mut (*slot).b)
//! };
//! ::core::mem::forget(__b_guard);
//! ::core::mem::forget(__a_guard);
@@ -1223,7 +1223,7 @@ fn assert_zeroable<T: $crate::Zeroable>(_: *mut T) {}
$crate::macros::paste! {
// SAFETY: We forget the guard later when initialization has succeeded.
let [< __ $field _guard >] = unsafe {
- $crate::__internal::DropGuard::new(::core::ptr::addr_of_mut!((*$slot).$field))
+ $crate::__internal::DropGuard::new(&raw mut (*$slot).$field)
};
$crate::__init_internal!(init_slot($use_data):
@@ -1246,7 +1246,7 @@ fn assert_zeroable<T: $crate::Zeroable>(_: *mut T) {}
//
// SAFETY: `slot` is valid, because we are inside of an initializer closure, we
// return when an error/panic occurs.
- unsafe { $crate::Init::__init(init, ::core::ptr::addr_of_mut!((*$slot).$field))? };
+ unsafe { $crate::Init::__init(init, &raw mut (*$slot).$field)? };
// Create the drop guard:
//
// We rely on macro hygiene to make it impossible for users to access this local variable.
@@ -1254,7 +1254,7 @@ fn assert_zeroable<T: $crate::Zeroable>(_: *mut T) {}
$crate::macros::paste! {
// SAFETY: We forget the guard later when initialization has succeeded.
let [< __ $field _guard >] = unsafe {
- $crate::__internal::DropGuard::new(::core::ptr::addr_of_mut!((*$slot).$field))
+ $crate::__internal::DropGuard::new(&raw mut (*$slot).$field)
};
$crate::__init_internal!(init_slot():
@@ -1286,7 +1286,7 @@ fn assert_zeroable<T: $crate::Zeroable>(_: *mut T) {}
$crate::macros::paste! {
// SAFETY: We forget the guard later when initialization has succeeded.
let [< __ $field _guard >] = unsafe {
- $crate::__internal::DropGuard::new(::core::ptr::addr_of_mut!((*$slot).$field))
+ $crate::__internal::DropGuard::new(&raw mut (*$slot).$field)
};
$crate::__init_internal!(init_slot($($use_data)?):
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v6 18/18] rust: clippy: disallow `addr_of[_mut]!` macros
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (16 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 17/18] rust: pin-init: refactor to use `&raw mut` Antonio Hickey
@ 2025-04-18 1:41 ` Antonio Hickey
2025-04-18 13:45 ` [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Miguel Ojeda
18 siblings, 0 replies; 21+ messages in thread
From: Antonio Hickey @ 2025-04-18 1:41 UTC (permalink / raw)
To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich
Cc: Antonio Hickey, rust-for-linux, linux-kernel
With the `raw_ref_op` feature enabled we no longer want to
allow use of the `addr_of!` and `addr_of_mut!` macros.
We instead want to use `&raw const` and `&raw mut` to get raw
pointers to a place.
Note that this lint isn't currently reliable, but we enable
it nevertheless because:
1. Document that one shouldn't use the `addr_of[_mut]!` macros.
2. When the lint becomes useful we will already have it enabled.
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Link: https://github.com/rust-lang/rust-clippy/issues/11431
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
---
.clippy.toml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.clippy.toml b/.clippy.toml
index 815c94732ed7..b7d87377a468 100644
--- a/.clippy.toml
+++ b/.clippy.toml
@@ -8,4 +8,8 @@ disallowed-macros = [
# The `clippy::dbg_macro` lint only works with `std::dbg!`, thus we simulate
# it here, see: https://github.com/rust-lang/rust-clippy/issues/11303.
{ path = "kernel::dbg", reason = "the `dbg!` macro is intended as a debugging tool" },
+ # With `raw_ref_op` feature enabled we no longer want to allow use of `addr_of!`
+ # and `addr_of_mut!` macros, but instead suggest use of `&raw const` or `&raw mut`.
+ { path = "core::ptr::addr_of_mut", reason = "use `&raw mut` instead `addr_of_mut!`" },
+ { path = "core::ptr::addr_of", reason = "use `&raw const` instead `addr_of!`" },
]
--
2.48.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v6 00/18] refactor to utilize `&raw [const|mut]`
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
` (17 preceding siblings ...)
2025-04-18 1:41 ` [PATCH v6 18/18] rust: clippy: disallow `addr_of[_mut]!` macros Antonio Hickey
@ 2025-04-18 13:45 ` Miguel Ojeda
18 siblings, 0 replies; 21+ messages in thread
From: Miguel Ojeda @ 2025-04-18 13:45 UTC (permalink / raw)
To: Antonio Hickey
Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux
On Fri, Apr 18, 2025 at 3:42 AM Antonio Hickey
<contact@antoniohickey.com> wrote:
>
> This patch set enables the `raw_ref_op` feature, which became stable
> in Rust 1.82.
This part already happened :)
> It then replaces all occurences of `addr_of!(place)` and
> `addr_of_mut!(place)` with `&raw const place` and `&raw mut place`.
Thanks for all this work!
We should give other subsystems the chance to pick the patches (or at
least Ack them). I can pick the rest, or even others, after others
have had a chance to take a look.
> Finally it adds the previous macros `addr_of!` and `addr_of_mut!` to
> the disallowed macros in `.clippy.toml`.
I have also considered picking that last one, but it does catch a lot
of uses already even if it may not be fully reliable, so we should
wait on enabling it right away to avoid screens full of Clippy
warnings.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v6 01/18] rust: init: refactor to use `&raw mut`
2025-04-18 1:41 ` [PATCH v6 01/18] rust: init: refactor to use `&raw mut` Antonio Hickey
@ 2025-04-21 20:20 ` Benno Lossin
0 siblings, 0 replies; 21+ messages in thread
From: Benno Lossin @ 2025-04-21 20:20 UTC (permalink / raw)
To: Antonio Hickey, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich
Cc: rust-for-linux, linux-kernel
On Fri Apr 18, 2025 at 3:41 AM CEST, Antonio Hickey wrote:
> Replacing all occurrences of `addr_of_mut!(place)`
> with `&raw mut place`.
>
> This will allow us to reduce macro complexity, and improve consistency
> with existing reference syntax as `&raw mut` is similar to `&mut`
> making it fit more naturally with other existing code.
>
> Suggested-by: Benno Lossin <benno.lossin@proton.me>
> Link: https://github.com/Rust-for-Linux/linux/issues/1148
> Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
> ---
> rust/kernel/init.rs | 4 ++--
> rust/pin-init/src/macros.rs | 12 ++++++------
Can you move the changes to the files in `pin-init` into a single
commit? You have both this one and number 17.
Also, do you mind doing the pin-init changes via the upstream GitHub [1]
repository? If not, I can take the patches upstream myself, but doing it
there is easier for me & also runs the CI there. Thanks in advance!
[1]: https://github.com/Rust-for-Linux/pin-init
---
Cheers,
Benno
> 2 files changed, 8 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2025-04-21 20:21 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-18 1:41 [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 01/18] rust: init: refactor to use `&raw mut` Antonio Hickey
2025-04-21 20:20 ` Benno Lossin
2025-04-18 1:41 ` [PATCH v6 02/18] rust: list: refactor to use `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 03/18] rust: task: remove use of `addr_of!` macro Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 04/18] rust: faux: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 05/18] rust: kunit: refactor to use `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 06/18] rust: workqueue: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 07/18] rust: workqueue: replace `raw_get` with pointer cast Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 08/18] rust: rbtree: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 09/18] rust: net: phy: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 10/18] rust: sync: arc: refactor to use `&raw const` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 11/18] rust: jump_label: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 12/18] rust: fs: file: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 13/18] rust: time: hrtimer: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 14/18] rust: pci: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 15/18] rust: platform: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 16/18] rust: dma: refactor to use `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 17/18] rust: pin-init: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 18/18] rust: clippy: disallow `addr_of[_mut]!` macros Antonio Hickey
2025-04-18 13:45 ` [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` 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).