Rust for Linux List
 help / color / mirror / Atom feed
* [PATCH v2 0/5] rust: pin-init: merge `__init` and `__pinned_init`
@ 2026-07-29 15:38 Gary Guo
  2026-07-29 15:38 ` [PATCH v2 1/5] rust: pin-init: examples: use `Wrapper::pin_init` instead of manual reimplementation Gary Guo
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Gary Guo @ 2026-07-29 15:38 UTC (permalink / raw)
  To: Benno Lossin, Miguel Ojeda, Boqun Feng, Björn Roy Baron,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
	Onur Özkan, Michal Wilczynski
  Cc: rust-for-linux, linux-pwm, linux-kernel, Gary Guo

Currently we have `PinInit::__pinned_init` and `Init::__init` which has
slightly different safety requirement but are required to do the same
thing. Instead of having to duplicate impl everywhere, it's simpler to just
use `Init` as a marker trait that cancels out the pinning requirement on
`PinInit::__pinned_init`. This also simplifies code (and shorten the symbol
name) so `__init` can always be used.

However, there are multiple users currently using `__pinned_init`. This is
not designed to be public API; however `pin_init` failed to provide a
public API alternative so it is still being used. Add `ptr_init` and
`ptr_try_init` methods and convert users to use them instead. `__init`
users can use these as well due to the super-trait relationship.

Signed-off-by: Gary Guo <gary@garyguo.net>
---
Changes in v2:
- Add a public API for `__init` and convert users.
- Remove the part about multiple cycles. Danilo suggests me to take the
  entirety in single cycle as this doesn't conflict with other branches.
- Link to v1: https://patch.msgid.link/20260722-merge-init-v1-0-d4594de76538@garyguo.net

---
Gary Guo (5):
      rust: pin-init: examples: use `Wrapper::pin_init` instead of manual reimplementation
      rust: pin-init: merge `__pinned_init` and `__init`
      rust: pin-init: add `ptr_init` and `ptr_try_init` and recommend over `__init`
      rust: treewide: replace `__pinned_init` with `ptr_[try_]init`
      rust: pin-init: remove `__pinned_init` method for `cfg(kernel)`

 drivers/gpu/nova-core/gsp/cmdq.rs     |   4 +-
 rust/kernel/alloc/kbox.rs             |   8 +-
 rust/kernel/dma.rs                    |  10 +-
 rust/kernel/drm/device.rs             |   2 +-
 rust/kernel/drm/gpuvm/va.rs           |   2 +-
 rust/kernel/drm/gpuvm/vm_bo.rs        |   2 +-
 rust/kernel/init.rs                   |   6 +-
 rust/kernel/pwm.rs                    |   2 +-
 rust/kernel/sync/arc.rs               |   8 +-
 rust/kernel/types.rs                  |   8 +-
 rust/macros/module.rs                 |   2 +-
 rust/pin-init/examples/mutex.rs       |   6 +-
 rust/pin-init/examples/static_init.rs |  10 +-
 rust/pin-init/src/__internal.rs       |   8 +-
 rust/pin-init/src/alloc.rs            |   6 +-
 rust/pin-init/src/lib.rs              | 177 +++++++++++++++++-----------------
 16 files changed, 128 insertions(+), 133 deletions(-)
---
base-commit: 6d0795b507fb1db2e6aefe533d949db3a4abf4c6
change-id: 20260722-merge-init-3ed98519ec7f

Best regards,
--  
Gary Guo <gary@garyguo.net>


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

end of thread, other threads:[~2026-08-05 10:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 15:38 [PATCH v2 0/5] rust: pin-init: merge `__init` and `__pinned_init` Gary Guo
2026-07-29 15:38 ` [PATCH v2 1/5] rust: pin-init: examples: use `Wrapper::pin_init` instead of manual reimplementation Gary Guo
2026-07-29 15:38 ` [PATCH v2 2/5] rust: pin-init: merge `__pinned_init` and `__init` Gary Guo
2026-07-29 15:38 ` [PATCH v2 3/5] rust: pin-init: add `ptr_init` and `ptr_try_init` and recommend over `__init` Gary Guo
2026-08-05 10:22   ` Benno Lossin
2026-08-05 10:56     ` Gary Guo
2026-07-29 15:38 ` [PATCH v2 4/5] rust: treewide: replace `__pinned_init` with `ptr_[try_]init` Gary Guo
2026-07-30 14:03   ` Danilo Krummrich
2026-08-03 12:19   ` Miguel Ojeda
2026-07-29 15:38 ` [PATCH v2 5/5] rust: pin-init: remove `__pinned_init` method for `cfg(kernel)` Gary Guo
2026-08-03 13:54 ` [PATCH v2 0/5] rust: pin-init: merge `__init` and `__pinned_init` Gary Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox