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>
This commit is contained in:
Kumar Gala 2020-05-08 12:25:25 -05:00 committed by Carles Cufí
parent 3a68566d40
commit 4a5a90aef8

View file

@ -380,17 +380,9 @@ def write_child_functions(node):
# 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):