]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - include/libfdt.h
libfdt: Sync fdt_for_each_subnode() with upstream
[people/ms/u-boot.git] / include / libfdt.h
index f3b61c94271ad57cd4d5395fa155ff7fa0cb4d70..398748c5c4953f3d5a1ca4714a216d315b033073 100644 (file)
@@ -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))