On Fri, Nov 22, 2024 at 2:13 AM Dirk Behme <dirk.behme@xxxxxxxxxxxx> wrote: > > From: "Rob Herring (Arm)" <robh@xxxxxxxxxx> > > The device property API is a firmware agnostic API for reading > properties from firmware (DT/ACPI) devices nodes and swnodes. > > While the C API takes a pointer to a caller allocated variable/buffer, > the rust API is designed to return a value and can be used in struct > initialization. Rust generics are also utilized to support different > sizes of properties (e.g. u8, u16, u32). > > To build and run the Examples as `rustdoc` tests the kernel Kconfig > options `CONFIG_OF` and `CONFIG_OF_UNITTEST` need to be enabled > additionally. Besides the default `rustdoc` test options > `CONFIG_KUNIT` and `CONFIG_RUST_KERNEL_DOCTESTS`. This even works > on non-ARM architectures as a test device tree is built into the > kernel, then. > > The Integer trait is proposed by Alic Ryhl [1]. > > Link: https://lore.kernel.org/rust-for-linux/CAH5fLgiXPZqKpWSSNdx-Ww-E9h2tOLcF3_8Y4C_JQ0eU8EMwFw@xxxxxxxxxxxxxx/ [1] > Co-developed-by: Dirk Behme <dirk.behme@xxxxxxxxxxxx> > Signed-off-by: Dirk Behme <dirk.behme@xxxxxxxxxxxx> > Signed-off-by: Rob Herring (Arm) <robh@xxxxxxxxxx> > --- > > This is an update of Rob's initial patch I have my own updates on it based on the discussion. It's a bit different because I've reworked the C API to better mesh with Rust needs. I just haven't sent it out because I've been busy with other things and it's the merge window. You asked me if I was going to work on this and I did. If you want to do it, just say so. I'm always happy for less work. Rob