scripts: gen_defines: rearrange some internals

Consolidate child helper macros into a single function. No functional
changes expected.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2022-03-23 13:26:24 -07:00 committed by Carles Cufí
commit 355cc01a36

View file

@ -132,8 +132,7 @@ def main():
out_dt_define(f"{node.z_path_id}_PARENT",
f"DT_{node.parent.z_path_id}")
write_child_functions(node)
write_child_functions_status_okay(node)
write_children(node)
write_dep_info(node)
write_idents_and_existence(node)
write_bus(node)
@ -531,9 +530,8 @@ def write_compatibles(node):
f"{node.z_path_id}_COMPAT_MATCHES_{str2ident(compat)}", 1)
def write_child_functions(node):
# Writes macro that are helpers that will call a macro/function
# for each child node.
def write_children(node):
# Writes helper macros for dealing with node's children.
out_dt_define(f"{node.z_path_id}_FOREACH_CHILD(fn)",
" ".join(f"fn(DT_{child.z_path_id})" for child in
@ -543,10 +541,6 @@ def write_child_functions(node):
" ".join(f"fn(DT_{child.z_path_id}, __VA_ARGS__)" for child in
node.children.values()))
def write_child_functions_status_okay(node):
# Writes macros that are helpers that will call a macro/function
# for each child node with status "okay".
functions = ''
functions_args = ''
for child in node.children.values():