sanitycheck: Add dt_chosen_enabled devicetree filter function
Add a dt_chosen_enabled(chosen) filter function to sanitycheck. The
function returns true if the devicetree /chosen node contains 'chosen'
and the referenced node is enabled.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
diff --git a/scripts/sanity_chk/expr_parser.py b/scripts/sanity_chk/expr_parser.py
index 4fc324a..38fe4e0 100644
--- a/scripts/sanity_chk/expr_parser.py
+++ b/scripts/sanity_chk/expr_parser.py
@@ -240,6 +240,12 @@
if node.status == "okay" and alias in node.aliases and node.matching_compat == compat:
return True
return False
+ elif ast[0] == "dt_chosen_enabled":
+ chosen = ast[1][0]
+ node = edt.chosen_node(chosen)
+ if node and node.status == "okay":
+ return True
+ return False
mutex = threading.Lock()