scripts/dts/extract: Add get_parent_address helper function

We have a few places that we want the path to the parent, so lets add a
helper function for that.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2018-10-03 18:41:29 -05:00 committed by Kumar Gala
commit bf0001242c
2 changed files with 8 additions and 4 deletions

View file

@ -174,12 +174,18 @@ def get_node_label(node_compat, node_address):
convert_string_to_label(node_address.split('/')[-1])
return def_label
def find_parent_prop(node_address, prop):
def get_parent_address(node_address):
parent_address = ''
for comp in node_address.split('/')[1:-1]:
parent_address += '/' + comp
return parent_address
def find_parent_prop(node_address, prop):
parent_address = get_parent_address(node_address)
if prop in reduced[parent_address]['props']:
parent_prop = reduced[parent_address]['props'].get(prop)
else:

View file

@ -323,9 +323,7 @@ def extract_property(node_compat, yaml, node_address, prop, prop_val, names,
if 'parent' in yaml[node_compat]:
if 'bus' in yaml[node_compat]['parent']:
# get parent label
parent_address = ''
for comp in node_address.split('/')[1:-1]:
parent_address += '/' + comp
parent_address = get_parent_address(node_address)
#check parent has matching child bus value
try: