From: Li Yang Date: Wed, 9 Dec 2009 14:26:07 +0800 Subject: [U-Boot] [PATCH 2/3] fdt: add fdt_del_node_by_path() API In-Reply-To: <1260339968-28169-1-git-send-email-leoli@freescale.com> References: <1260339968-28169-1-git-send-email-leoli@freescale.com> Message-ID: <1260339968-28169-2-git-send-email-leoli@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de For removing node easily by path or alias. Signed-off-by: Li Yang --- 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