libfdt: Make unit address optional for finding nodes

Jon Loeliger jdl at jdl.com
Mon Oct 15 23:35:18 EST 2007


So, like, the other day David Gibson mumbled:
> 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 at gibson.dropbear.id.au>
> ---

Applied.


> Jon, I initially considered making this behaviour optional,
> i.e. adding a flag to subnode_offset() determining if it needed exact
> matches or name-without-address matches.  I couldn't see that it was
> actually any use, though.

Yeah, sounds fine to me too.

Thanks,
jdl



More information about the Linuxppc-dev mailing list