Add a Rust abstraction for the kernel's devres (device resource management) implementation. The Devres type acts as a container to manage the lifetime and accessibility of device bound resources. Therefore it registers a devres callback and revokes access to the resource on invocation. Users of the Devres abstraction can simply free the corresponding resources in their Drop implementation, which is invoked when either the Devres instance goes out of scope or the devres callback leads to the resource being revoked, which implies a call to drop_in_place(). Signed-off-by: Danilo Krummrich <dakr@kernel.org> Tested-by: Dirk Behme <dirk.behme@de.bosch.com> Link: https://lore.kernel.org/r/20241219170425.12036-9-dakr@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35 lines
807 B
C
35 lines
807 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Non-trivial C macros cannot be used in Rust. Similarly, inlined C functions
|
|
* cannot be called either. This file explicitly creates functions ("helpers")
|
|
* that wrap those so that they can be called from Rust.
|
|
*
|
|
* Sorted alphabetically.
|
|
*/
|
|
|
|
#include "blk.c"
|
|
#include "bug.c"
|
|
#include "build_assert.c"
|
|
#include "build_bug.c"
|
|
#include "cred.c"
|
|
#include "device.c"
|
|
#include "err.c"
|
|
#include "fs.c"
|
|
#include "io.c"
|
|
#include "jump_label.c"
|
|
#include "kunit.c"
|
|
#include "mutex.c"
|
|
#include "page.c"
|
|
#include "pid_namespace.c"
|
|
#include "rbtree.c"
|
|
#include "rcu.c"
|
|
#include "refcount.c"
|
|
#include "security.c"
|
|
#include "signal.c"
|
|
#include "slab.c"
|
|
#include "spinlock.c"
|
|
#include "task.c"
|
|
#include "uaccess.c"
|
|
#include "vmalloc.c"
|
|
#include "wait.c"
|
|
#include "workqueue.c"
|