rust: init: add `stack_pin_init!` macro
authorBenno Lossin <benno.lossin@proton.me>
Sat, 8 Apr 2023 12:26:07 +0000 (12:26 +0000)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 12 Apr 2023 16:41:05 +0000 (18:41 +0200)
commit6841d45a303029c54d6ad1ebb5dc72f7b2a74700
tree27f649511edf9eba57f7c7ed89f97a929f12a115
parentd0fdc3961270617826e4794fca1d092853847707
rust: init: add `stack_pin_init!` macro

The `stack_pin_init!` macro allows pin-initializing a value on the
stack. It accepts a `impl PinInit<T, E>` to initialize a `T`. It allows
propagating any errors via `?` or handling it normally via `match`.

Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/r/20230408122429.1103522-11-y86-dev@protonmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/init.rs
rust/kernel/init/__internal.rs