]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: add `Revocable` type
authorWedson Almeida Filho <wedsonaf@gmail.com>
Thu, 19 Dec 2024 17:04:08 +0000 (18:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Dec 2024 16:19:26 +0000 (17:19 +0100)
commit0494d9c82b0c722d8ce2af7dc5f92be6aef4625b
tree75e38c8092fa77ba5ee9eb609c8cb268db016da1
parent2d3bf6ffe26439444b55dd5af7b06d1aca3a042d
rust: add `Revocable` type

Revocable allows access to objects to be safely revoked at run time.

This is useful, for example, for resources allocated during device probe;
when the device is removed, the driver should stop accessing the device
resources even if another state is kept in memory due to existing
references (i.e., device context data is ref-counted and has a non-zero
refcount after removal of the device).

Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com>
Co-developed-by: Danilo Krummrich <dakr@kernel.org>
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-7-dakr@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
rust/kernel/lib.rs
rust/kernel/revocable.rs [new file with mode: 0644]