diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index 30c936b373360f..70809f58ef3fb7 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -1588,13 +1588,19 @@ def _check_undeclared_props(self) -> None: for prop_name in self._node.props: # Allow a few special properties to not be declared in the binding - if prop_name.endswith("-controller") or \ - prop_name.startswith("#") or \ - prop_name in { + if (prop_name.endswith("-controller") + or prop_name.startswith("#") + or prop_name in { "compatible", "status", "ranges", "phandle", - "interrupt-parent", "interrupts-extended", "device_type"}: + "interrupt-parent", "interrupts-extended", "device_type"}): continue + if '_' in prop_name: + _err(f"{prop_name}' should use hyphens instead of " + "underscores in the property name. " + f"The property names at '{self.edt.dts_path}' " + f"and '{self.binding_path}' must also be updated.") + if TYPE_CHECKING: assert self._binding @@ -2331,10 +2337,11 @@ def _init_luts(self) -> None: if self._werror: handler_fn: Any = _err else: - handler_fn = _LOG.warning + handler_fn = _warn handler_fn( f"node '{node.path}' compatible '{compat}' " - f"has unknown vendor prefix '{vendor}'") + f"has unknown vendor prefix '{vendor}'" + ) for compat, nodes in self.compat2okay.items(): self.compat2nodes[compat].extend(nodes) @@ -3221,11 +3228,14 @@ def _check_dt(dt: DT) -> None: "(see the devicetree specification)") +# Logging object +_LOG = logging.getLogger(__name__) + def _err(msg) -> NoReturn: raise EDTError(msg) -# Logging object -_LOG = logging.getLogger(__name__) +def _warn(msg) -> None: + _LOG.warning(msg) # Regular expression for non-alphanumeric-or-underscore characters. _NOT_ALPHANUM_OR_UNDERSCORE = re.compile(r'\W', re.ASCII)