From: Kumar Gala Date: Tue, 30 Mar 2010 10:20:34 -0500 Subject: [U-Boot] [PATCH] fdt: Add fdt_del_node_and_alias helper Message-ID: <1269962434-13058-1-git-send-email-galak@kernel.crashing.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add a helper function that given an alias will delete both the node the alias points to and the alias itself Signed-off-by: Kumar Gala --- common/fdt_support.c | 13 +++++++++++++ include/fdt_support.h | 2 ++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/common/fdt_support.c b/common/fdt_support.c index f89a3ee..dd46be9 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -757,3 +757,16 @@ int fdt_fixup_nor_flash_size(void *blob, int cs, u32 size) return -1; } #endif + +void fdt_del_node_and_alias(void *blob, char *alias) +{ + int off = fdt_path_offset(blob, alias); + + if (off < 0) + return; + + fdt_del_node(blob, off); + + off = fdt_path_offset(blob, "/aliases"); + fdt_delprop(blob, off, alias); +} diff --git a/include/fdt_support.h b/include/fdt_support.h index 0a9dd0d..e3949dd 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -81,5 +81,7 @@ int fdt_resize(void *blob); int fdt_fixup_nor_flash_size(void *blob, int cs, u32 size); +void fdt_del_node_and_alias(void *blob, char *alias); + #endif /* ifdef CONFIG_OF_LIBFDT */ #endif /* ifndef __FDT_SUPPORT_H */ -- 1.6.0.6