]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - lib/fdtdec_common.c
net: hifemac_mdio: use log_msg_ret() correctly, report error by dev_err()
[thirdparty/u-boot.git] / lib / fdtdec_common.c
index 63b704a3d719b178c79da4068a477aded2c80e9f..ca36ff15952b8e9b8bd9cad549a7902798a830db 100644 (file)
@@ -1,16 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2014
  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  *
  * Based on lib/fdtdec.c:
  * Copyright (c) 2011 The Chromium OS Authors.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef USE_HOSTCC
-#include <common.h>
-#include <libfdt.h>
+#include <log.h>
+#include <linux/libfdt.h>
 #include <fdtdec.h>
 #else
 #include "libfdt.h"
@@ -54,3 +53,14 @@ unsigned int fdtdec_get_uint(const void *blob, int node, const char *prop_name,
        debug("(not found)\n");
        return default_val;
 }
+
+int fdtdec_get_child_count(const void *blob, int node)
+{
+       int subnode;
+       int num = 0;
+
+       fdt_for_each_subnode(subnode, blob, node)
+               num++;
+
+       return num;
+}