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:
parent
f7067655d6
commit
bf0001242c
2 changed files with 8 additions and 4 deletions
|
@ -174,12 +174,18 @@ def get_node_label(node_compat, node_address):
|
||||||
convert_string_to_label(node_address.split('/')[-1])
|
convert_string_to_label(node_address.split('/')[-1])
|
||||||
return def_label
|
return def_label
|
||||||
|
|
||||||
def find_parent_prop(node_address, prop):
|
def get_parent_address(node_address):
|
||||||
parent_address = ''
|
parent_address = ''
|
||||||
|
|
||||||
for comp in node_address.split('/')[1:-1]:
|
for comp in node_address.split('/')[1:-1]:
|
||||||
parent_address += '/' + comp
|
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']:
|
if prop in reduced[parent_address]['props']:
|
||||||
parent_prop = reduced[parent_address]['props'].get(prop)
|
parent_prop = reduced[parent_address]['props'].get(prop)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -323,9 +323,7 @@ def extract_property(node_compat, yaml, node_address, prop, prop_val, names,
|
||||||
if 'parent' in yaml[node_compat]:
|
if 'parent' in yaml[node_compat]:
|
||||||
if 'bus' in yaml[node_compat]['parent']:
|
if 'bus' in yaml[node_compat]['parent']:
|
||||||
# get parent label
|
# get parent label
|
||||||
parent_address = ''
|
parent_address = get_parent_address(node_address)
|
||||||
for comp in node_address.split('/')[1:-1]:
|
|
||||||
parent_address += '/' + comp
|
|
||||||
|
|
||||||
#check parent has matching child bus value
|
#check parent has matching child bus value
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue