]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: device: Add child accessor and iterator
authorRemo Senekowitsch <remo@buenzli.dev>
Mon, 16 Jun 2025 15:45:09 +0000 (17:45 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 25 Jun 2025 15:18:07 +0000 (17:18 +0200)
commitc942dba38064cd35214c6b3249120f3f2945e810
tree06b642dcebc097fa4fe6760edeb08e598ae4021f
parent63dafeb392139b893a73b6331f347613f0929702
rust: device: Add child accessor and iterator

Allow Rust drivers to access children of a fwnode either by name or by
iterating over all of them.

In C, there is the function `fwnode_get_next_child_node` for iteration
and the macro `fwnode_for_each_child_node` that helps with handling the
pointers. Instead of a macro, a native iterator is used in Rust such
that regular for-loops can be used.

Tested-by: Dirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: Remo Senekowitsch <remo@buenzli.dev>
Link: https://lore.kernel.org/r/20250616154511.1862909-2-remo@buenzli.dev
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/device/property.rs