<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/rust/pin-init, 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: examples: use `Wrapper::pin_init` instead of manual reimplementation</title>
<updated>2026-08-03T12:36:34+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-29T15:38:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c998b661b7c024dfd6dd893927506e32ee8a42c5'/>
<id>c998b661b7c024dfd6dd893927506e32ee8a42c5</id>
<content type='text'>
`UnsafeCell` gains the method via the extension trait `Wrapper`.

Link: https://patch.msgid.link/20260729-merge-init-v2-1-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>
`UnsafeCell` gains the method via the extension trait `Wrapper`.

Link: https://patch.msgid.link/20260729-merge-init-v2-1-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: internal: rework how `#[pin_data]` handles cfg</title>
<updated>2026-07-27T10:52:08+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-23T18:19:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5bbf2b2deb94d0ef8324866d39cb5e0947ca5068'/>
<id>5bbf2b2deb94d0ef8324866d39cb5e0947ca5068</id>
<content type='text'>
Attribute macros are invoked without cfg being resolved. This adds quite a
bit complexity to the macro because all of the macro needs to be careful to
attach necessary cfgs. This becomes especially tricky for tuple structs.
Thus, it is convenient if cfgs are all resolved like derive macros.

The most optimal way to handle this is via `TokenStream::expand_expr`, but
that is still unstable. We can also create an internal derive macro and
transform the attribute macro invocation to be derive macro, but doing
requires us to serialize all extracted information in a form of helper
attributes; it would also make it more difficult if we want to make changes
to the struct (which the self-reference feature would need).

Implement an approach where we generate two cfg-gated macro invocations
with cfg resolved within the invocation. This would mean when the loop
falls through, all field cfgs are resolved, so remove all handling of
cfg_attrs for the rest of the macro.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Attribute macros are invoked without cfg being resolved. This adds quite a
bit complexity to the macro because all of the macro needs to be careful to
attach necessary cfgs. This becomes especially tricky for tuple structs.
Thus, it is convenient if cfgs are all resolved like derive macros.

The most optimal way to handle this is via `TokenStream::expand_expr`, but
that is still unstable. We can also create an internal derive macro and
transform the attribute macro invocation to be derive macro, but doing
requires us to serialize all extracted information in a form of helper
attributes; it would also make it more difficult if we want to make changes
to the struct (which the self-reference feature would need).

Implement an approach where we generate two cfg-gated macro invocations
with cfg resolved within the invocation. This would mean when the loop
falls through, all field cfgs are resolved, so remove all handling of
cfg_attrs for the rest of the macro.

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>
</feed>
