From ea1df3e07cc5a4b155e69fcb7f583cb7f4c2cbe3 Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Thu, 21 Mar 2019 19:09:58 +0100 Subject: libfdt: Add phandle generation helper The new fdt_generate_phandle() function can be used to generate a new, unused phandle given a specific device tree blob. The implementation is somewhat naive in that it simply walks the entire device tree to find the highest phandle value and then returns a phandle value one higher than that. A more clever implementation might try to find holes in the current set of phandle values and fill them. But this implementation is relatively simple and works reliably. Also add a test that validates that phandles generated by this new API are indeed unique. Signed-off-by: Thierry Reding Reviewed-by: Simon Glass --- scripts/dtc/libfdt/libfdt_env.h | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts/dtc/libfdt/libfdt_env.h') diff --git a/scripts/dtc/libfdt/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h index bd247462877..3ff9e286307 100644 --- a/scripts/dtc/libfdt/libfdt_env.h +++ b/scripts/dtc/libfdt/libfdt_env.h @@ -52,6 +52,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include -- cgit v1.2.3