Skip to contentSkip to conversation

fdt: Add fdt_del_node_and_alias helper

PATCH Superseded Kumar Gala 2 participants 3 messages Mar 30, 2010 – Mar 31, 2010

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH v2 1/1 fdt: Add fdt_del_node_and_alias helper

Add a helper function that given an alias will delete both the node the alias points to and the alias itself

---
* Make alias param const

 common/fdt_support.c  |   13 +++++++++++++
 include/fdt_support.h |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)
common/fdt_support.c +13 -0
index f89a3ee..0d0f513 100644
@@ -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, const 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);
+}
include/fdt_support.h +2 -0
index 0a9dd0d..5388c29 100644
@@ -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, const char *alias);
+
 #endif /* ifdef CONFIG_OF_LIBFDT */
 #endif /* ifndef __FDT_SUPPORT_H */
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH v2 1/1 fdt: Add fdt_del_node_and_alias helper

Hi Kumar,

Quoted 4 lines · Kumar Gala

Add a helper function that given an alias will delete both the node the alias points to and the alias itself

I assume you will want to apply this with the 8xxx patch that uses it, so...

Quoted 40 lines

---
* Make alias param const

 common/fdt_support.c  |   13 +++++++++++++
 include/fdt_support.h |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)
common/fdt_support.c +13 -0
index f89a3ee..0d0f513 100644
@@ -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, const 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);
+}
include/fdt_support.h +2 -0
index 0a9dd0d..5388c29 100644
@@ -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, const char *alias);
+
 #endif /* ifdef CONFIG_OF_LIBFDT */
 #endif /* ifndef __FDT_SUPPORT_H */
author
#2 lore raw

PATCH v2 1/1 fdt: Add fdt_del_node_and_alias helper

Quoted 10 lines · Gerald Van Baren

Hi Kumar,

Quoted 3 lines · Kumar Gala

Add a helper function that given an alias will delete both the node the alias points to and the alias itself

I assume you will want to apply this with the 8xxx patch that uses it, so...

Yep, thanks.

- k