scripts/pylib: expr_parser.py: Review dt_compat_enabled_with_label

Function used for filtering "dt_compat_enabled_with_label" was not
working as expected as it was not taking into account that we're
looking for a children/parent combination:
Provided "compat" with enabled status should be the one of the parent
of the node matching given label.

Function is then reworked to take this into account.
And to make it's usage clear:
- function name is changed to be clearer on the intention
- args order is reversed to be more logical wrt the intention

Users of the function are also updated to take the change into
account.

Fixes #36093

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2021-06-11 09:36:27 +02:00 committed by Anas Nashif
commit 3e1443ccf9
3 changed files with 8 additions and 7 deletions

View file

@ -264,11 +264,12 @@ def ast_expr(ast, env, edt):
return ast_handle_dt_enabled_alias_with_parent_compat(edt, alias,
compat)
elif ast[0] == "dt_compat_enabled_with_label":
compat = ast[1][0]
label = ast[1][1]
elif ast[0] == "dt_label_with_parent_compat_enabled":
compat = ast[1][1]
label = ast[1][0]
node = edt.label2node.get(label)
return node is not None and node.status == 'okay' and node.matching_compat == compat
parent = node.parent
return parent is not None and parent.status == 'okay' and parent.matching_compat == compat
elif ast[0] == "dt_chosen_enabled":
chosen = ast[1][0]
node = edt.chosen_node(chosen)