Re: [PATCH 2/5] devres: export devres_node_init() and devres_node_add()

From: Danilo Krummrich

Date: Fri Feb 06 2026 - 09:09:53 EST


On Fri Feb 6, 2026 at 2:33 PM CET, Alice Ryhl wrote:
> So you'd need a non-generic Rust function with #[inline(never)] in this case,
> and have Devres::<T>::new() call that function.

Then we should probably figure out how we can teach bindgen to apply
#[inline(never)] for functions that are not exported. Because I don't think we
always want to write such wrappers by hand.

#[inline(never)]
#[allow(clippy::missing_safety_doc)]
unsafe fn devres_node_init(
node: *mut bindings::devres_node,
release: bindings::dr_node_release_t,
free: bindings::dr_node_free_t,
) {
// SAFETY: `devres_node_init()` inherits the safety requirements of
// `bindings::devres_node_init()`.
unsafe { bindings::devres_node_init(node, release, free) };
}

(I could probably abstract it on a higher level, but it would still create quite
some (unsafe) churn.)