Skip to content

Commit

Permalink
scripts: dts: gen_defines: redundant sorting
Browse files Browse the repository at this point in the history
Removes redundant sorting of nodes.

Signed-off-by: Florian Grandel <[email protected]>
  • Loading branch information
fg-cfh authored and benediktibk committed Sep 10, 2024
1 parent 59fa5b6 commit 5b5be31
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/dts/gen_defines.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,24 @@ def main():

write_utils()

sorted_nodes = sorted(edt.nodes, key=lambda node: node.dep_ordinal)

# populate all z_path_id first so any children references will
# work correctly.
for node in sorted(edt.nodes, key=lambda node: node.dep_ordinal):
for node in sorted_nodes:
node.z_path_id = node_z_path_id(node)

# Check to see if we have duplicate "zephyr,memory-region" property values.
regions = dict()
for node in sorted(edt.nodes, key=lambda node: node.dep_ordinal):
for node in sorted_nodes:
if 'zephyr,memory-region' in node.props:
region = node.props['zephyr,memory-region'].val
if region in regions:
sys.exit(f"ERROR: Duplicate 'zephyr,memory-region' ({region}) properties "
f"between {regions[region].path} and {node.path}")
regions[region] = node

for node in sorted(edt.nodes, key=lambda node: node.dep_ordinal):
for node in sorted_nodes:
write_node_comment(node)

out_comment("Node's full path:")
Expand Down

0 comments on commit 5b5be31

Please sign in to comment.