<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/rust/pin-init/src, branch master</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>rust: pin-init: add `#[inline]` to small functions</title>
<updated>2026-08-05T10:36:18+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-08-03T13:02:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1e26aea0355ad2afa1ccbc62885c01f5bcfc58ca'/>
<id>1e26aea0355ad2afa1ccbc62885c01f5bcfc58ca</id>
<content type='text'>
Currently `pin-init` crate is missing many inline annotations. They are all
generic so still get inlined in normal builds, but are not inlined in
`-C opt-level=s` build. Mark these functions as `#[inline]` so they are
considered for inlining regardless.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently `pin-init` crate is missing many inline annotations. They are all
generic so still get inlined in normal builds, but are not inlined in
`-C opt-level=s` build. Mark these functions as `#[inline]` so they are
considered for inlining regardless.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: remove `__pinned_init` method for `cfg(kernel)`</title>
<updated>2026-08-05T10:36:18+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-29T15:38:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1f7fa1374d3bb455944128fe5c30c19f8d3501c7'/>
<id>1f7fa1374d3bb455944128fe5c30c19f8d3501c7</id>
<content type='text'>
Remove `__pinned_init` for kernel configuration, with all users gone.
Still perserve it temporarily as deprecated so other users have time to
move off it.

Link: https://patch.msgid.link/20260729-merge-init-v2-5-26adf47109e7@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove `__pinned_init` for kernel configuration, with all users gone.
Still perserve it temporarily as deprecated so other users have time to
move off it.

Link: https://patch.msgid.link/20260729-merge-init-v2-5-26adf47109e7@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: add `raw_init` and `raw_try_init` and recommend over `__init`</title>
<updated>2026-08-05T10:36:16+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-29T15:38:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d5492db2bf30b7e617e41d4fe3dba22475a1a354'/>
<id>d5492db2bf30b7e617e41d4fe3dba22475a1a354</id>
<content type='text'>
The `__init` method is not designed to be a public API (existence of "__"
is a hint for this); but currently there is no other API that allows raw
initialization on pointers. Add `raw_init` and `raw_try_init` and recommend
people to use this instead if raw pointer initialization is needed.

Link: https://patch.msgid.link/20260729-merge-init-v2-3-26adf47109e7@garyguo.net
[ Renamed from `ptr_[try_]init` to `raw_[try_]init`. - Gary ]
Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `__init` method is not designed to be a public API (existence of "__"
is a hint for this); but currently there is no other API that allows raw
initialization on pointers. Add `raw_init` and `raw_try_init` and recommend
people to use this instead if raw pointer initialization is needed.

Link: https://patch.msgid.link/20260729-merge-init-v2-3-26adf47109e7@garyguo.net
[ Renamed from `ptr_[try_]init` to `raw_[try_]init`. - Gary ]
Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: merge `__pinned_init` and `__init`</title>
<updated>2026-08-03T12:36:42+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-29T15:38:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=91665820d9bf511e0c3fdf3edb464ba23130dafe'/>
<id>91665820d9bf511e0c3fdf3edb464ba23130dafe</id>
<content type='text'>
These functions have the same requirements and are also required to execute
the same code. Prevent duplication by merging them to the single function
and document the additional relaxation of `Init::__init` on both the merged
function and the safety requirement of `Init`.

The existing `__pinned_init` function is deprecated and kept for
compatibility for existing users. For `cfg(kernel)`, it is soft-deprecated
for now and will be removed when all users are migrated.

Link: https://patch.msgid.link/20260729-merge-init-v2-2-26adf47109e7@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These functions have the same requirements and are also required to execute
the same code. Prevent duplication by merging them to the single function
and document the additional relaxation of `Init::__init` on both the merged
function and the safety requirement of `Init`.

The existing `__pinned_init` function is deprecated and kept for
compatibility for existing users. For `cfg(kernel)`, it is soft-deprecated
for now and will be removed when all users are migrated.

Link: https://patch.msgid.link/20260729-merge-init-v2-2-26adf47109e7@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: mark `pin_init::zeroed` and `Zeroable::zeroed` as `#[inline]`</title>
<updated>2026-07-27T10:52:08+00:00</updated>
<author>
<name>Nicolás Antinori</name>
<email>nico.antinori.7@gmail.com</email>
</author>
<published>2026-07-23T18:19:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6d0795b507fb1db2e6aefe533d949db3a4abf4c6'/>
<id>6d0795b507fb1db2e6aefe533d949db3a4abf4c6</id>
<content type='text'>
The `pin_init::zeroed` function is a trivial wrapper around
`unsafe { core::mem::zeroed() }`, whereas `Zeroable::zeroed` is a trivial
wrapper around `pin_init::zeroed`. Mark them both as `#[inline]` to avoid
generating unnecessary symbols for them.

Signed-off-by: Nicolás Antinori &lt;nico.antinori.7@gmail.com&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `pin_init::zeroed` function is a trivial wrapper around
`unsafe { core::mem::zeroed() }`, whereas `Zeroable::zeroed` is a trivial
wrapper around `pin_init::zeroed`. Mark them both as `#[inline]` to avoid
generating unnecessary symbols for them.

Signed-off-by: Nicolás Antinori &lt;nico.antinori.7@gmail.com&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: docs: link `Zeroable::zeroed` and `pin_init::zeroed` in documentation</title>
<updated>2026-07-27T10:52:08+00:00</updated>
<author>
<name>Nicolás Antinori</name>
<email>nico.antinori.7@gmail.com</email>
</author>
<published>2026-07-23T18:19:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9e813b9abdfb626f0607b1ec94d201a2b8691f4e'/>
<id>9e813b9abdfb626f0607b1ec94d201a2b8691f4e</id>
<content type='text'>
Modify the comments in the `pin_init::zeroed` and `Zeroable::zeroed`
functions to cross-reference each other and make developers aware of both
options.

This also adapts the example code in `Zeroable::zeroed` doc comments to use
that function.

Suggested-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Link: https://lore.kernel.org/rust-for-linux/CANiq72kdCAyRUmXFcqQfkHpk1miG8Gagsn0_5U8p4WpKxv9d_g@mail.gmail.com/
Signed-off-by: Nicolás Antinori &lt;nico.antinori.7@gmail.com&gt;
[ Fix link. - Gary ]
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Modify the comments in the `pin_init::zeroed` and `Zeroable::zeroed`
functions to cross-reference each other and make developers aware of both
options.

This also adapts the example code in `Zeroable::zeroed` doc comments to use
that function.

Suggested-by: Miguel Ojeda &lt;ojeda@kernel.org&gt;
Link: https://lore.kernel.org/rust-for-linux/CANiq72kdCAyRUmXFcqQfkHpk1miG8Gagsn0_5U8p4WpKxv9d_g@mail.gmail.com/
Signed-off-by: Nicolás Antinori &lt;nico.antinori.7@gmail.com&gt;
[ Fix link. - Gary ]
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: make `[pin_]chain` unwind safe</title>
<updated>2026-07-13T11:11:44+00:00</updated>
<author>
<name>Mirko Adzic</name>
<email>adzicmirko97@gmail.com</email>
</author>
<published>2026-07-10T16:20:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0c20f77a26b89bc911d31cd79f1abe1a7ae57f60'/>
<id>0c20f77a26b89bc911d31cd79f1abe1a7ae57f60</id>
<content type='text'>
Add a drop guard before the call to the chained closure so that the value
initialized by the first stage is dropped if the closure errors or panics;
`mem::forget` the guard on success.

The previous code only ran cleanup on the explicit error path, leaking the
first-stage value if the chained closure panicked.

Reported-by: Gary Guo &lt;gary@garyguo.net&gt;
Closes: https://github.com/Rust-for-Linux/pin-init/issues/136
Suggested-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Mirko Adzic &lt;adzicmirko97@gmail.com&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-7-8fa16cde87ae@garyguo.net
[ Fix Clippy missing safety comment false positive when `slot` and `guard`
  creation are merged in a single line. - Gary ]
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a drop guard before the call to the chained closure so that the value
initialized by the first stage is dropped if the closure errors or panics;
`mem::forget` the guard on success.

The previous code only ran cleanup on the explicit error path, leaking the
first-stage value if the chained closure panicked.

Reported-by: Gary Guo &lt;gary@garyguo.net&gt;
Closes: https://github.com/Rust-for-Linux/pin-init/issues/136
Suggested-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Mirko Adzic &lt;adzicmirko97@gmail.com&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-7-8fa16cde87ae@garyguo.net
[ Fix Clippy missing safety comment false positive when `slot` and `guard`
  creation are merged in a single line. - Gary ]
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: make `[pin_]init_array_from_fn` unwind safe</title>
<updated>2026-07-13T11:11:29+00:00</updated>
<author>
<name>Mirko Adzic</name>
<email>adzicmirko97@gmail.com</email>
</author>
<published>2026-07-10T16:20:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7e4d9c946de525cac36bb693c42a147b8e9f03c5'/>
<id>7e4d9c946de525cac36bb693c42a147b8e9f03c5</id>
<content type='text'>
The previous code only ran cleanup on the explicit error path. If the per-
element initializer panicked partway through, the elements already written
into the array would be leaked: their `Drop` impls would never run. This
violates the pinning requirement.

Fix the unwind safety issue by adding a guard type that drops element on
both error and panic path.

To avoid having to duplicate code between `pin_init_array_from_fn` and the
non-pin variant, extract the code to a shared `ArrayInit` type; this type
is internal and not visible via API.

Reported-by: Gary Guo &lt;gary@garyguo.net&gt;
Closes: https://github.com/Rust-for-Linux/pin-init/issues/136
Signed-off-by: Mirko Adzic &lt;adzicmirko97@gmail.com&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-6-8fa16cde87ae@garyguo.net
[ Split guard type and the initializer type, move the guard type to be
  within __pinned_init. - Gary ]
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous code only ran cleanup on the explicit error path. If the per-
element initializer panicked partway through, the elements already written
into the array would be leaked: their `Drop` impls would never run. This
violates the pinning requirement.

Fix the unwind safety issue by adding a guard type that drops element on
both error and panic path.

To avoid having to duplicate code between `pin_init_array_from_fn` and the
non-pin variant, extract the code to a shared `ArrayInit` type; this type
is internal and not visible via API.

Reported-by: Gary Guo &lt;gary@garyguo.net&gt;
Closes: https://github.com/Rust-for-Linux/pin-init/issues/136
Signed-off-by: Mirko Adzic &lt;adzicmirko97@gmail.com&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-6-8fa16cde87ae@garyguo.net
[ Split guard type and the initializer type, move the guard type to be
  within __pinned_init. - Gary ]
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: remove redundant clippy expects in doc tests</title>
<updated>2026-07-13T11:10:00+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-10T16:20:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=690d82bf1da92f0a073df3728b76d4dbc99b5172'/>
<id>690d82bf1da92f0a073df3728b76d4dbc99b5172</id>
<content type='text'>
These lints are automatically suppressed inside doc tests. Previously this
is needed because kernel builds doc tests with the default set of clippy
flags; but now `clippy::disallowed_names` is globally allowed inside doc
tests.

Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-3-8fa16cde87ae@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These lints are automatically suppressed inside doc tests. Previously this
is needed because kernel builds doc tests with the default set of clippy
flags; but now `clippy::disallowed_names` is globally allowed inside doc
tests.

Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-3-8fa16cde87ae@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: remove `E` from `InitClosure`</title>
<updated>2026-05-29T20:34:53+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-27T17:19:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f85906616ec70d1d0178073b16ebd1c7f6ff1ee7'/>
<id>f85906616ec70d1d0178073b16ebd1c7f6ff1ee7</id>
<content type='text'>
Move `E` from type to trait impl block. This greatly shortens the
monomorphized type names. The `__pinned_init` function name is only
slightly shortened as it still encodes the `E` as part of `PinInit&lt;T, E&gt;`
in the symbol.

`T` cannot be moved to trait impl block otherwise it will start to conflict
with the `impl Init&lt;T&gt; for T` as Rust cannot deduce that there're no types
that fulfill `T: FnOnce(*mut T)`.

Link: https://patch.msgid.link/20260527-pin-init-sync-v1-6-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move `E` from type to trait impl block. This greatly shortens the
monomorphized type names. The `__pinned_init` function name is only
slightly shortened as it still encodes the `E` as part of `PinInit&lt;T, E&gt;`
in the symbol.

`T` cannot be moved to trait impl block otherwise it will start to conflict
with the `impl Init&lt;T&gt; for T` as Rust cannot deduce that there're no types
that fulfill `T: FnOnce(*mut T)`.

Link: https://patch.msgid.link/20260527-pin-init-sync-v1-6-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
