Skip to content

Commit 89bf698

Browse files
57300fabiobaltieri
authored andcommitted
twister: Remove dt_compat_enabled_with_alias filter
It has been deprecated since Zephyr v2.6.0. The filter that replaced it - `dt_enabled_alias_with_parent_compat` - had shared code with it, which can now be inlined into `ast_expr()` to match the parser's overall code structure. Signed-off-by: Grzegorz Swiderski <[email protected]>
1 parent 02045f1 commit 89bf698

File tree

1 file changed

+7
-35
lines changed

1 file changed

+7
-35
lines changed

scripts/pylib/twister/expr_parser.py

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -240,30 +240,16 @@ def ast_expr(ast, env, edt):
240240
# Checks if the DT has an enabled alias node whose parent has
241241
# a given compatible. For matching things like gpio-leds child
242242
# nodes, which do not have compatibles themselves.
243-
#
244-
# The legacy "dt_compat_enabled_with_alias" form is still
245-
# accepted but is now deprecated and causes a warning. This is
246-
# meant to give downstream users some time to notice and
247-
# adjust. Its argument order only made sense under the (bad)
248-
# assumption that the gpio-leds child node has the same compatible
249243

250244
alias = ast[1][0]
251245
compat = ast[1][1]
252-
253-
return ast_handle_dt_enabled_alias_with_parent_compat(edt, alias,
254-
compat)
255-
elif ast[0] == "dt_compat_enabled_with_alias":
256-
compat = ast[1][0]
257-
alias = ast[1][1]
258-
259-
_logger.warning('dt_compat_enabled_with_alias("%s", "%s"): '
260-
'this is deprecated, use '
261-
'dt_enabled_alias_with_parent_compat("%s", "%s") '
262-
'instead',
263-
compat, alias, alias, compat)
264-
265-
return ast_handle_dt_enabled_alias_with_parent_compat(edt, alias,
266-
compat)
246+
for node in edt.nodes:
247+
parent = node.parent
248+
if parent is None:
249+
continue
250+
if node.status == "okay" and alias in node.aliases and parent.matching_compat == compat:
251+
return True
252+
return False
267253
elif ast[0] == "dt_label_with_parent_compat_enabled":
268254
compat = ast[1][1]
269255
label = ast[1][0]
@@ -286,20 +272,6 @@ def ast_expr(ast, env, edt):
286272
return True
287273
return False
288274

289-
def ast_handle_dt_enabled_alias_with_parent_compat(edt, alias, compat):
290-
# Helper shared with the now deprecated
291-
# dt_compat_enabled_with_alias version.
292-
293-
for node in edt.nodes:
294-
parent = node.parent
295-
if parent is None:
296-
continue
297-
if (node.status == "okay" and alias in node.aliases and
298-
parent.matching_compat == compat):
299-
return True
300-
301-
return False
302-
303275
mutex = threading.Lock()
304276

305277
def parse(expr_text, env, edt):

0 commit comments

Comments
 (0)