rust: add abstraction for struct device
authorDanilo Krummrich <dakr@redhat.com>
Tue, 18 Jun 2024 15:48:34 +0000 (17:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Jun 2024 16:45:06 +0000 (18:45 +0200)
commita674fefd17324fc467f043568e738b80ca22f2b4
treeee984f25a8a4b6d1a7742b8d51e7ad25c61964db
parentfca3eff7d36bcd1a51d2c256ccebbe3617d4fe3a
rust: add abstraction for struct device

Add an (always) reference-counted abstraction for a generic C `struct
device`. This abstraction encapsulates existing `struct device` instances
and manages its reference count.

Subsystems may use this abstraction as a base to abstract subsystem
specific device instances based on a generic `struct device`, such as
`struct pci_dev`.

Co-developed-by: Wedson Almeida Filho <wedsonaf@gmail.com>
Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://lore.kernel.org/r/20240618154841.6716-2-dakr@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
rust/helpers.c
rust/kernel/device.rs [new file with mode: 0644]
rust/kernel/lib.rs