libfdt: Add phandle generation helper
The new fdt_generate_phandle() function can be used to generate a new, unused phandle given a specific device tree blob. The implementation is somewhat naive in that it simply walks the entire device tree to find the highest phandle value and then returns a phandle value one higher than that. A more clever implementation might try to find holes in the current set of phandle values and fill them. But this implementation is relatively simple and works reliably. Also add a test that validates that phandles generated by this new API are indeed unique. Signed-off-by: Thierry Reding <treding@nvidia.com> Message-Id: <20190320151003.28941-1-thierry.reding@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
committed by
David Gibson
parent
4762ad051e
commit
54ea41c224
@@ -39,6 +39,11 @@ m1: mq: /memreserve/ 0 0x1000;
|
||||
n2 = &n2;
|
||||
n3 = &n3;
|
||||
};
|
||||
|
||||
node6 {
|
||||
linux,phandle = <0xfffffffe>;
|
||||
phandle = <0xfffffffe>;
|
||||
};
|
||||
};
|
||||
|
||||
/ {
|
||||
|
||||
Reference in New Issue
Block a user