gen_defines: Rework implementation of write_child_functions
Rework how write_child_functions to match how we do the code for
DT_FOREACH_OKAY_INST.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py
index 2216d8e..87f5234 100755
--- a/scripts/dts/gen_defines.py
+++ b/scripts/dts/gen_defines.py
@@ -380,17 +380,9 @@
# Writes macro that are helpers that will call a macro/function
# for each child node.
- if node.children:
- functions = ''
- # For each subnode with non-empty list of labels add the
- # first (non-alias) label to the string of ', ' separated
- # list of labels.
- for subnode in node.children.values():
- functions = functions + f"fn(DT_{subnode.z_path_id}) "
-
- if functions:
- macro = f"{node.z_path_id}_FOREACH_CHILD(fn)"
- out_dt_define(macro, functions)
+ out_dt_define(f"{node.z_path_id}_FOREACH_CHILD(fn)",
+ " ".join(f"fn(DT_{child.z_path_id})" for child in
+ node.children.values()))
def write_status(node):