diff mbox series

[v2,2/5] rust: helpers: Add `is_of_node` helper function

Message ID 20250605162454.3659309-1-igor.korotin.linux@gmail.com
State New
Headers show
Series rust: Add ACPI match table support for Rust drivers | expand

Commit Message

Igor Korotin June 5, 2025, 4:24 p.m. UTC
Add a helper function to determine whether a given device appears to be
an Open Firmware (OF) node.

This function will be used in Rust driver abstractions to support both
ACPI and OF matching simultaneously in subsequent patches.

Signed-off-by: Igor Korotin <igor.korotin.linux@gmail.com>
---
 MAINTAINERS            | 1 +
 rust/helpers/helpers.c | 1 +
 rust/helpers/of.c      | 6 ++++++
 3 files changed, 8 insertions(+)
 create mode 100644 rust/helpers/of.c
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 5f8dfae08454..d6cadaa592aa 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18215,6 +18215,7 @@  T:	git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
 F:	Documentation/ABI/testing/sysfs-firmware-ofw
 F:	drivers/of/
 F:	include/linux/of*.h
+F:	rust/helpers/of.c
 F:	rust/kernel/of.rs
 F:	scripts/dtc/
 F:	tools/testing/selftests/dt/
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 80785b1e7a63..2fc5242aa47a 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -21,6 +21,7 @@ 
 #include "jump_label.c"
 #include "kunit.c"
 #include "mutex.c"
+#include "of.c"
 #include "page.c"
 #include "platform.c"
 #include "pci.c"
diff --git a/rust/helpers/of.c b/rust/helpers/of.c
new file mode 100644
index 000000000000..8913eaced716
--- /dev/null
+++ b/rust/helpers/of.c
@@ -0,0 +1,6 @@ 
+#include <linux/of.h>
+
+bool rust_helper_is_of_node(const struct fwnode_handle *fwnode)
+{
+    return is_of_node(fwnode);
+}