summaryrefslogtreecommitdiff
path: root/include/libfdt.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-10-02 17:59:29 -0600
committerSimon Glass <sjg@chromium.org>2016-10-13 14:10:32 -0600
commitdf87e6b1b815ae3484ea2aa7c53b90af382eae1b (patch)
tree63ec3cbdc467ddac4191e150fecc9350dada75c5 /include/libfdt.h
parentb02e4044ff8ee1f6ac83917a39514172a9b449fb (diff)
downloadu-boot-df87e6b1b815ae3484ea2aa7c53b90af382eae1b.tar.gz
libfdt: Sync fdt_for_each_subnode() with upstream
The signature for this macro has changed. Bring in the upstream version and adjust U-Boot's usages to suit. Signed-off-by: Simon Glass <sjg@chromium.org> Update to drivers/power/pmic/palmas.c: Signed-off-by: Keerthy <j-keerthy@ti.com> Change-Id: I6cc9021339bfe686f9df21d61a1095ca2b3776e8
Diffstat (limited to 'include/libfdt.h')
-rw-r--r--include/libfdt.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/include/libfdt.h b/include/libfdt.h
index f3b61c9427..398748c5c4 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -176,24 +176,27 @@ int fdt_next_subnode(const void *fdt, int offset);
/**
* fdt_for_each_subnode - iterate over all subnodes of a parent
*
+ * @node: child node (int, lvalue)
+ * @fdt: FDT blob (const void *)
+ * @parent: parent node (int)
+ *
* This is actually a wrapper around a for loop and would be used like so:
*
- * fdt_for_each_subnode(fdt, node, parent) {
- * ...
- * use node
+ * fdt_for_each_subnode(node, fdt, parent) {
+ * Use node
* ...
* }
*
- * Note that this is implemented as a macro and node is used as iterator in
- * the loop. It should therefore be a locally allocated variable. The parent
- * variable on the other hand is never modified, so it can be constant or
- * even a literal.
+ * if ((node < 0) && (node != -FDT_ERR_NOT_FOUND)) {
+ * Error handling
+ * }
+ *
+ * Note that this is implemented as a macro and @node is used as
+ * iterator in the loop. The parent variable be constant or even a
+ * literal.
*
- * @fdt: FDT blob (const void *)
- * @node: child node (int)
- * @parent: parent node (int)
*/
-#define fdt_for_each_subnode(fdt, node, parent) \
+#define fdt_for_each_subnode(node, fdt, parent) \
for (node = fdt_first_subnode(fdt, parent); \
node >= 0; \
node = fdt_next_subnode(fdt, node))