mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-28 18:27:42 +08:00
Replace Devres::new_foreign_owned() with devres::register(). The current implementation of Devres::new_foreign_owned() creates a full Devres container instance, including the internal Revocable and completion. However, none of that is necessary for the intended use of giving full ownership of an object to devres and getting it dropped once the given device is unbound. Hence, implement devres::register(), which is limited to consume the given data, wrap it in a KBox and drop the KBox once the given device is unbound, without any other synchronization. Cc: Dave Airlie <airlied@redhat.com> Cc: Simona Vetter <simona.vetter@ffwll.ch> Cc: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Benno Lossin <lossin@kernel.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20250626200054.243480-3-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
18 lines
375 B
C
18 lines
375 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/device.h>
|
|
|
|
int rust_helper_devm_add_action(struct device *dev,
|
|
void (*action)(void *),
|
|
void *data)
|
|
{
|
|
return devm_add_action(dev, action, data);
|
|
}
|
|
|
|
int rust_helper_devm_add_action_or_reset(struct device *dev,
|
|
void (*action)(void *),
|
|
void *data)
|
|
{
|
|
return devm_add_action_or_reset(dev, action, data);
|
|
}
|