[U-Boot] [PATCH 2/3] fdt: add fdt_del_node_by_path() API

Li Yang leoli at freescale.com
Wed Dec 9 07:26:07 CET 2009


For removing node easily by path or alias.

Signed-off-by: Li Yang <leoli at freescale.com>
---
 common/fdt_support.c  |   10 ++++++++++
 include/fdt_support.h |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index f89a3ee..8f1186e 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -757,3 +757,13 @@ int fdt_fixup_nor_flash_size(void *blob, int cs, u32 size)
 	return -1;
 }
 #endif
+
+int fdt_del_node_by_path(void *fdt, const char *path)
+{
+	int off = fdt_path_offset(fdt, path);
+
+	if (off >= 0)
+		return fdt_del_node(fdt, off);
+	else
+		return off;
+}
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 0a9dd0d..d0705d1 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -80,6 +80,7 @@ void set_working_fdt_addr(void *addr);
 int fdt_resize(void *blob);
 
 int fdt_fixup_nor_flash_size(void *blob, int cs, u32 size);
+int fdt_del_node_by_path(void *fdt, const char *path);
 
 #endif /* ifdef CONFIG_OF_LIBFDT */
 #endif /* ifndef __FDT_SUPPORT_H */
-- 
1.6.4



More information about the U-Boot mailing list