* [PATCH v2] rust: acpi: replace manual zero-initialization with `pin_init::zeroed()`
@ 2025-12-01 15:52 Atharv Dubey
2026-01-08 14:00 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Atharv Dubey @ 2025-12-01 15:52 UTC (permalink / raw)
To: Rafael J . Wysocki
Cc: Len Brown, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, linux-acpi, rust-for-linux,
linux-kernel, Atharv Dubey
Use `pin_init::zeroed()` instead of `core::mem::zeroed()` for initializing
`acpi_device_id`. This removes an explicit unsafe block and aligns ACPI
initialization with the pin-init conversion used across the Rust tree.
Link: https://github.com/Rust-for-Linux/linux/issues/1189
Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
---
rust/kernel/acpi.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/rust/kernel/acpi.rs b/rust/kernel/acpi.rs
index 37e1161c1298..cc98b36b90a0 100644
--- a/rust/kernel/acpi.rs
+++ b/rust/kernel/acpi.rs
@@ -40,8 +40,7 @@ pub const fn new(id: &'static CStr) -> Self {
let src = id.to_bytes_with_nul();
build_assert!(src.len() <= Self::ACPI_ID_LEN, "ID exceeds 16 bytes");
// Replace with `bindings::acpi_device_id::default()` once stabilized for `const`.
- // SAFETY: FFI type is valid to be zero-initialized.
- let mut acpi: bindings::acpi_device_id = unsafe { core::mem::zeroed() };
+ let mut acpi: bindings::acpi_device_id = pin_init::zeroed();
let mut i = 0;
while i < src.len() {
acpi.id[i] = src[i];
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] rust: acpi: replace manual zero-initialization with `pin_init::zeroed()`
2025-12-01 15:52 [PATCH v2] rust: acpi: replace manual zero-initialization with `pin_init::zeroed()` Atharv Dubey
@ 2026-01-08 14:00 ` Rafael J. Wysocki
2026-01-08 14:01 ` Danilo Krummrich
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2026-01-08 14:00 UTC (permalink / raw)
To: Atharv Dubey
Cc: Rafael J . Wysocki, Len Brown, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
linux-acpi, rust-for-linux, linux-kernel
On Mon, Dec 1, 2025 at 4:52 PM Atharv Dubey <atharvd440@gmail.com> wrote:
>
> Use `pin_init::zeroed()` instead of `core::mem::zeroed()` for initializing
> `acpi_device_id`. This removes an explicit unsafe block and aligns ACPI
> initialization with the pin-init conversion used across the Rust tree.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1189
> Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
A Rust-side ACK or equivalent would be welcome.
> ---
> rust/kernel/acpi.rs | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/rust/kernel/acpi.rs b/rust/kernel/acpi.rs
> index 37e1161c1298..cc98b36b90a0 100644
> --- a/rust/kernel/acpi.rs
> +++ b/rust/kernel/acpi.rs
> @@ -40,8 +40,7 @@ pub const fn new(id: &'static CStr) -> Self {
> let src = id.to_bytes_with_nul();
> build_assert!(src.len() <= Self::ACPI_ID_LEN, "ID exceeds 16 bytes");
> // Replace with `bindings::acpi_device_id::default()` once stabilized for `const`.
> - // SAFETY: FFI type is valid to be zero-initialized.
> - let mut acpi: bindings::acpi_device_id = unsafe { core::mem::zeroed() };
> + let mut acpi: bindings::acpi_device_id = pin_init::zeroed();
> let mut i = 0;
> while i < src.len() {
> acpi.id[i] = src[i];
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] rust: acpi: replace manual zero-initialization with `pin_init::zeroed()`
2026-01-08 14:00 ` Rafael J. Wysocki
@ 2026-01-08 14:01 ` Danilo Krummrich
2026-01-08 14:07 ` Alice Ryhl
2026-01-08 14:23 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Danilo Krummrich @ 2026-01-08 14:01 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Atharv Dubey, Len Brown, Miguel Ojeda, Alex Gaynor, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Trevor Gross, linux-acpi, rust-for-linux,
linux-kernel
On 1/8/26 3:00 PM, Rafael J. Wysocki wrote:
> On Mon, Dec 1, 2025 at 4:52 PM Atharv Dubey <atharvd440@gmail.com> wrote:
>>
>> Use `pin_init::zeroed()` instead of `core::mem::zeroed()` for initializing
>> `acpi_device_id`. This removes an explicit unsafe block and aligns ACPI
>> initialization with the pin-init conversion used across the Rust tree.
>>
>> Link: https://github.com/Rust-for-Linux/linux/issues/1189
>> Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
>
> A Rust-side ACK or equivalent would be welcome.
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] rust: acpi: replace manual zero-initialization with `pin_init::zeroed()`
2026-01-08 14:00 ` Rafael J. Wysocki
2026-01-08 14:01 ` Danilo Krummrich
@ 2026-01-08 14:07 ` Alice Ryhl
2026-01-08 14:23 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Alice Ryhl @ 2026-01-08 14:07 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Atharv Dubey, Len Brown, Miguel Ojeda, Alex Gaynor, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, linux-acpi, rust-for-linux,
linux-kernel
On Thu, Jan 8, 2026 at 3:00 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Mon, Dec 1, 2025 at 4:52 PM Atharv Dubey <atharvd440@gmail.com> wrote:
> >
> > Use `pin_init::zeroed()` instead of `core::mem::zeroed()` for initializing
> > `acpi_device_id`. This removes an explicit unsafe block and aligns ACPI
> > initialization with the pin-init conversion used across the Rust tree.
> >
> > Link: https://github.com/Rust-for-Linux/linux/issues/1189
> > Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
>
> A Rust-side ACK or equivalent would be welcome.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] rust: acpi: replace manual zero-initialization with `pin_init::zeroed()`
2026-01-08 14:00 ` Rafael J. Wysocki
2026-01-08 14:01 ` Danilo Krummrich
2026-01-08 14:07 ` Alice Ryhl
@ 2026-01-08 14:23 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-01-08 14:23 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Atharv Dubey, Len Brown, Miguel Ojeda, Alex Gaynor, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Trevor Gross, Danilo Krummrich, linux-acpi,
rust-for-linux, linux-kernel
On Thu, Jan 8, 2026 at 3:00 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> A Rust-side ACK or equivalent would be welcome.
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-08 14:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-01 15:52 [PATCH v2] rust: acpi: replace manual zero-initialization with `pin_init::zeroed()` Atharv Dubey
2026-01-08 14:00 ` Rafael J. Wysocki
2026-01-08 14:01 ` Danilo Krummrich
2026-01-08 14:07 ` Alice Ryhl
2026-01-08 14:23 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®