Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions scripts/dts/python-devicetree/src/devicetree/edtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2025,8 +2025,8 @@ def __init__(self,

werror (default: False):
If True, some edtlib specific warnings become errors. This currently
errors out if 'dts' has any deprecated properties set, or an unknown
vendor prefix is used.
errors out if 'dts' has any deprecated properties set, warn_reg_unit_address_mismatch
triggers a warning or an unknown vendor prefix is used.
"""
# All instance attributes should be initialized here.
# This makes it easy to keep track of them, which makes
Expand All @@ -2053,6 +2053,7 @@ def __init__(self,
self._infer_binding_for_paths: set[str] = set(infer_binding_for_paths or [])
self._vendor_prefixes: dict[str, str] = vendor_prefixes or {}
self._werror: bool = bool(werror)
self._warn_handler: Any = _err if werror else _LOG.warning

# Other internal state
self._compat2binding: dict[tuple[str, Optional[str]], Binding] = {}
Expand Down Expand Up @@ -2359,9 +2360,9 @@ def _init_nodes(self) -> None:
# Address mismatch is ok for PCI devices
if (node.regs and node.regs[0].addr != node.unit_addr and
not node.is_pci_device):
_LOG.warning("unit address and first address in 'reg' "
f"(0x{node.regs[0].addr:x}) don't match for "
f"{node.path}")
self._warn_handler("unit address and first address in 'reg' "
f"(0x{node.regs[0].addr:x}) don't match for "
f"{node.path}")

def _init_luts(self) -> None:
# Initialize node lookup tables (LUTs).
Expand Down Expand Up @@ -2395,11 +2396,7 @@ def _init_luts(self) -> None:
# As an exception, the root node can have whatever
# compatibles it wants. Other nodes get checked.
elif node.path != '/':
if self._werror:
handler_fn: Any = _err
else:
handler_fn = _LOG.warning
handler_fn(
self._warn_handler(
f"node '{node.path}' compatible '{compat}' "
f"has unknown vendor prefix '{vendor}'")

Expand Down
Loading