[rtems-libbsd commit] linux/of.h: Add of_find_node_by_path()

Sebastian Huber sebh at rtems.org
Tue Jan 23 13:57:52 UTC 2018


Module:    rtems-libbsd
Branch:    master
Commit:    81fc57de35c529840c90028254d26766ec75b98e
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=81fc57de35c529840c90028254d26766ec75b98e

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jan 17 14:14:30 2018 +0100

linux/of.h: Add of_find_node_by_path()

Update #3277.

---

 rtemsbsd/powerpc/include/linux/of.h |  3 +++
 rtemsbsd/sys/powerpc/compat.c       | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/rtemsbsd/powerpc/include/linux/of.h b/rtemsbsd/powerpc/include/linux/of.h
index 8ef0469..e91baaa 100644
--- a/rtemsbsd/powerpc/include/linux/of.h
+++ b/rtemsbsd/powerpc/include/linux/of.h
@@ -88,6 +88,9 @@ bool of_device_is_available(const struct device_node *dn);
 
 int of_device_is_compatible(const struct device_node *dn, const char *name);
 
+struct device_node *of_find_node_by_path(struct device_node *dns,
+    const char *path);
+
 struct device_node *of_find_compatible_node(struct device_node *dns,
     const struct device_node *dn, const char *type, const char *compatible);
 
diff --git a/rtemsbsd/sys/powerpc/compat.c b/rtemsbsd/sys/powerpc/compat.c
index 400eac5..c0fdebb 100644
--- a/rtemsbsd/sys/powerpc/compat.c
+++ b/rtemsbsd/sys/powerpc/compat.c
@@ -90,6 +90,22 @@ of_device_is_compatible(const struct device_node *dn, const char *name)
 }
 
 struct device_node *
+of_find_node_by_path(struct device_node *dns, const char *path)
+{
+	const void *fdt = bsp_fdt_get();
+	int node;
+
+	memset(dns, 0, sizeof(*dns));
+
+	node = fdt_path_offset(fdt, path);
+	if (node < 0)
+		return (NULL);
+
+	dns->offset = node;
+	return (dns);
+}
+
+struct device_node *
 of_find_compatible_node(struct device_node *dns, const struct device_node *dn,
     const char *type, const char *compatible)
 {




More information about the vc mailing list