mirror of
https://github.com/dgibson/dtc.git
synced 2026-05-12 11:43:04 -04:00
libfdt: Make unit address optional for finding nodes
At present, the fdt_subnode_offset() and fdt_path_offset() functions in libfdt require the exact name of the nodes in question be passed, including unit address. This is contrary to traditional OF-like finddevice() behaviour, which allows the unit address to be omitted (which is useful when the device name is unambiguous without the address). This patch introduces similar behaviour to fdt_subnode_offset_namelen(), and hence to fdt_subnode_offset() and fdt_path_offset() which are implemented in terms of the former. The unit address can be omitted from the given node name. If this is ambiguous, the first such node in the flattened tree will be selected (this behaviour is consistent with IEEE1275 which specifies only that an arbitrary node matching the given information be selected). This very small change is then followed by many more diffs which change the test examples and testcases to exercise this behaviour. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
02a5556850
commit
d2a9da0458
17 changed files with 103 additions and 78 deletions
|
|
@ -74,10 +74,10 @@ int main(int argc, char *argv[])
|
|||
fdt = load_blob_arg(argc, argv);
|
||||
|
||||
check_name(fdt, "/");
|
||||
check_name(fdt, "/subnode1");
|
||||
check_name(fdt, "/subnode2");
|
||||
check_name(fdt, "/subnode1/subsubnode");
|
||||
check_name(fdt, "/subnode2/subsubnode");
|
||||
check_name(fdt, "/subnode@1");
|
||||
check_name(fdt, "/subnode@2");
|
||||
check_name(fdt, "/subnode@1/subsubnode");
|
||||
check_name(fdt, "/subnode@2/subsubnode@0");
|
||||
|
||||
PASS();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue