Skip to content

rust: pin-init: merge `__init` and `__pinned_init`

Gary Guo linux-pwm lkml rust-for-linux 2 versions – Applied

Status from this message: Applied to pin-init-next.

Get series with b4
b4 am [email protected] change-id 20260722-merge-init-3ed98519ec7f

Versions newest first

  1. v2 Latest5 patches 5 repliesApplied
  2. v14 patches 2 repliesApplied

Changes in v2 from the cover letter

- 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/[email protected]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/5rust: pin-init: examples: use `Wrapper::pin_init` instead of manual reimplementationrust/pin-init/examples/mutex.rs+1 -50 replies
2/5rust: pin-init: merge `__pinned_init` and `__init`rust/pin-init/examples/static_init.rs rust/pin-init/src/__internal.rs rust/pin-init/src/alloc.rs +1 more+67 -1020 replies
3/5rust: pin-init: add `ptr_init` and `ptr_try_init` and recommend over `__init`rust/pin-init/examples/static_init.rs rust/pin-init/src/lib.rs+34 -32 replies
4/5rust: treewide: replace `__pinned_init` with `ptr_[try_]init`drivers/gpu/nova-core/gsp/cmdq.rs rust/kernel/alloc/kbox.rs rust/kernel/dma.rs +8 more+28 -262 replies
5/5rust: pin-init: remove `__pinned_init` method for `cfg(kernel)`rust/pin-init/src/lib.rs+2 -10 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchDanilo KrummrichMiguel Ojeda
1/5
2/5
3/5
4/5A-b A-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/5] rust: pin-init: merge `__init` and `__pinned_init`

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.

---
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/[email protected]

---
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,

Signature · 1 line
Gary Guo <[email protected]>