rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 00/11] `Zeroable` improvements & bindings integration
@ 2025-08-14  9:30 Benno Lossin
  2025-08-14  9:30 ` [PATCH v3 01/11] rust: add `pin-init` as a dependency to `bindings` and `uapi` Benno Lossin
                   ` (11 more replies)
  0 siblings, 12 replies; 25+ messages in thread
From: Benno Lossin @ 2025-08-14  9:30 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: rust-for-linux

This came from a discussion at [1]. And I added some more useful parts
to the original idea.

I'm not sure on the impact of build times and rust-analyzer. We're
adding a derive macro to every struct and union emitted by bindgen.
Building using my test-config took 27.7s before and 28.2s after this
change, but those are only two runs on my machine with a very reduced
config (that enables all Rust code that we have at the moment).

Maybe we have to reevaluate this when more C code is scanned by bindgen.

[1]: https://rust-for-linux.zulipchat.com/#narrow/channel/291565-Help/topic/Zeroable.20trait.20for.20C.20structs/with/509711564

Changelog
=========
* v3:
  - removed already applied patches
  - added more patches replacing usage of `mem::zeroed` and
    `MaybeUninit::zeroed().assume_init()` with the new
    `pin_init::zeroed`
  - fix rusttest target
* v2:
  - added patches with more extensive pin-init changes to `Zeroable` &
    related methods. for the upstream PR, see
    https://github.com/Rust-for-Linux/pin-init/pull/56
  - added patches replacing usage of `mem::zeroed` and
    `MaybeUninit::zeroed().assume_init()` with the new
    `pin_init::zeroed`
  - fix rust-analyzer support 
  - use import in `{uapi,bindings}/lib.rs` to avoid the `pin_init::`
    prefix
* v1: https://lore.kernel.org/all/20250520192307.259142-1-lossin@kernel.org

Benno Lossin (11):
  rust: add `pin-init` as a dependency to `bindings` and `uapi`
  rust: derive `Zeroable` for all structs & unions generated by bindgen
    where possible
  rust: miscdevice: replace `MaybeUninit::zeroed().assume_init()` with
    `pin_init::zeroed()`
  rust: phy: replace `MaybeUninit::zeroed().assume_init()` with
    `pin_init::zeroed()`
  rust: block: replace `core::mem::zeroed` with `pin_init::zeroed`
  rust: of: replace `core::mem::zeroed` with `pin_init::zeroed`
  rust: security: replace `core::mem::zeroed` with `pin_init::zeroed`
  rust: drm: replace `core::mem::zeroed` with `pin_init::zeroed`
  rust: auxiliary: replace `core::mem::zeroed` with `pin_init::zeroed`
  rust: acpi: replace `core::mem::zeroed` with `pin_init::zeroed`
  rust: cpufreq: replace `MaybeUninit::zeroed().assume_init()` with
    `pin_init::zeroed()`

 rust/Makefile                     | 14 ++++++++------
 rust/bindgen_parameters           |  4 ++++
 rust/bindings/lib.rs              |  8 ++++++++
 rust/kernel/acpi.rs               |  4 +---
 rust/kernel/auxiliary.rs          |  6 +-----
 rust/kernel/block/mq/gen_disk.rs  |  3 +--
 rust/kernel/block/mq/tag_set.rs   |  4 +---
 rust/kernel/cpufreq.rs            |  4 +---
 rust/kernel/drm/gem/mod.rs        |  4 +---
 rust/kernel/miscdevice.rs         |  8 +++-----
 rust/kernel/net/phy.rs            |  4 +---
 rust/kernel/of.rs                 |  4 +---
 rust/kernel/security.rs           |  3 +--
 rust/uapi/lib.rs                  |  2 ++
 scripts/generate_rust_analyzer.py |  4 ++--
 15 files changed, 36 insertions(+), 40 deletions(-)


base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
-- 
2.50.1


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

end of thread, other threads:[~2025-08-27 17:31 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14  9:30 [PATCH v3 00/11] `Zeroable` improvements & bindings integration Benno Lossin
2025-08-14  9:30 ` [PATCH v3 01/11] rust: add `pin-init` as a dependency to `bindings` and `uapi` Benno Lossin
2025-08-27 17:30   ` Alice Ryhl
2025-08-14  9:30 ` [PATCH v3 02/11] rust: derive `Zeroable` for all structs & unions generated by bindgen where possible Benno Lossin
2025-08-27 17:30   ` Alice Ryhl
2025-08-14  9:30 ` [PATCH v3 03/11] rust: miscdevice: replace `MaybeUninit::zeroed().assume_init()` with `pin_init::zeroed()` Benno Lossin
2025-08-14  9:30 ` [PATCH v3 04/11] rust: phy: " Benno Lossin
2025-08-14  9:30 ` [PATCH v3 05/11] rust: block: replace `core::mem::zeroed` with `pin_init::zeroed` Benno Lossin
2025-08-14  9:30 ` [PATCH v3 06/11] rust: of: " Benno Lossin
2025-08-14  9:30 ` [PATCH v3 07/11] rust: security: " Benno Lossin
2025-08-14 15:19   ` Paul Moore
2025-08-14 15:31     ` Miguel Ojeda
2025-08-14 15:33       ` Miguel Ojeda
2025-08-14 15:38         ` Benno Lossin
2025-08-14 17:42           ` Miguel Ojeda
2025-08-14 15:54       ` Paul Moore
2025-08-14 17:28         ` Benno Lossin
2025-08-14 22:01           ` Paul Moore
2025-08-14 17:48         ` Miguel Ojeda
2025-08-14  9:30 ` [PATCH v3 08/11] rust: drm: " Benno Lossin
2025-08-14  9:30 ` [PATCH v3 09/11] rust: auxiliary: " Benno Lossin
2025-08-14  9:30 ` [PATCH v3 10/11] rust: acpi: " Benno Lossin
2025-08-14  9:30 ` [PATCH v3 11/11] rust: cpufreq: replace `MaybeUninit::zeroed().assume_init()` with `pin_init::zeroed()` Benno Lossin
2025-08-14  9:33   ` Viresh Kumar
2025-08-27 17:19 ` [PATCH v3 00/11] `Zeroable` improvements & bindings integration Alice Ryhl

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