Commit 49b97d9c8ea7b11c4fc9e457cc2cd9fd6ebf0c21

Authored by Kumar Gala
1 parent 69bcf5bc80

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

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>

Showing 2 changed files with 14 additions and 0 deletions Side-by-side Diff

common/fdt_support.c
... ... @@ -976,4 +976,17 @@
976 976 }
977 977 }
978 978 #endif
  979 +
  980 +void fdt_del_node_and_alias(void *blob, const char *alias)
  981 +{
  982 + int off = fdt_path_offset(blob, alias);
  983 +
  984 + if (off < 0)
  985 + return;
  986 +
  987 + fdt_del_node(blob, off);
  988 +
  989 + off = fdt_path_offset(blob, "/aliases");
  990 + fdt_delprop(blob, off, alias);
  991 +}
include/fdt_support.h
... ... @@ -82,6 +82,7 @@
82 82 int fdt_fixup_nor_flash_size(void *blob, int cs, u32 size);
83 83  
84 84 void fdt_fixup_mtdparts(void *fdt, void *node_info, int node_info_size);
  85 +void fdt_del_node_and_alias(void *blob, const char *alias);
85 86  
86 87 #endif /* ifdef CONFIG_OF_LIBFDT */
87 88 #endif /* ifndef __FDT_SUPPORT_H */