summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorShannon Zhao <shannon.zhao@linaro.org>2016-04-07 20:03:33 +0800
committerDavid Vrabel <david.vrabel@citrix.com>2016-07-06 10:34:46 +0100
commit9c6098685a1d5df72da61ff7838ebb1524796869 (patch)
tree4e24b0c39329c6de73c6394387f3ec3e9af8adea /drivers
parentbe1aaf4e4026118e4191117a48f8a8078d1c0ed4 (diff)
downloadlinux-9c6098685a1d5df72da61ff7838ebb1524796869.tar.bz2
FDT: Add a helper to get the subnode by given name
Sometimes it needs to check if there is a subnode of given node in FDT by given name. Introduce this helper to get the subnode if it exists. CC: Rob Herring <robh@kernel.org> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Rob Herring <robh@kernel.org> Tested-by: Julien Grall <julien.grall@arm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/fdt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 33daffc4392c..0e02947a8a7a 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -744,6 +744,19 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
}
/**
+ * of_get_flat_dt_subnode_by_name - get the subnode by given name
+ *
+ * @node: the parent node
+ * @uname: the name of subnode
+ * @return offset of the subnode, or -FDT_ERR_NOTFOUND if there is none
+ */
+
+int of_get_flat_dt_subnode_by_name(unsigned long node, const char *uname)
+{
+ return fdt_subnode_offset(initial_boot_params, node, uname);
+}
+
+/**
* of_get_flat_dt_root - find the root node in the flat blob
*/
unsigned long __init of_get_flat_dt_root(void)