Skip to content
Permalink
Browse files

dts: edtlib: Improve naming in _check_binding()

'keys' is really a dictionary of options (like {"type": "int", ...}) for
a property. Calling it 'options' makes it clearer.

Also s/prop/prop_name/.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
  • Loading branch information...
ulfalizer authored and galak committed Aug 8, 2019
1 parent e328e56 commit c0c8dd1b855357f92d7f2a7627cddf78781d2fa8
Showing with 9 additions and 7 deletions.
  1. +9 −7 scripts/dts/edtlib.py
@@ -1189,22 +1189,24 @@ def _check_binding(binding, binding_path):
ok_prop_keys = {"description", "type", "category", "constraint", "enum"}
ok_categories = {"required", "optional"}

for prop, keys in binding["properties"].items():
for key in keys:
for prop_name, options in binding["properties"].items():
for key in options:
if key not in ok_prop_keys:
_err("unknown setting '{}' in 'properties: {}: ...' in {}, "
"expected one of {}".format(
key, prop, binding_path, ", ".join(ok_prop_keys)))
key, prop_name, binding_path,
", ".join(ok_prop_keys)))

if "category" in keys and keys["category"] not in ok_categories:
if "category" in options and options["category"] not in ok_categories:
_err("unrecognized category '{}' for '{}' in 'properties' in {}, "
"expected one of {}".format(
keys["category"], prop, binding_path,
options["category"], prop_name, binding_path,
", ".join(ok_categories)))

if "description" in keys and not isinstance(keys["description"], str):
if "description" in options and \
not isinstance(options["description"], str):
_err("missing, malformed, or empty 'description' for '{}' in "
"'properties' in {}".format(prop, binding_path))
"'properties' in {}".format(prop_name, binding_path))


def _translate(addr, node):

0 comments on commit c0c8dd1

Please sign in to comment.
You can’t perform that action at this time.