On 2026-10-16T07:25:19, Mehmet Fide <[email protected]> wrote: > dm: core: add ofnode_get_alias_seq() > > The sequence number an aliases entry gives a node can only be looked up > for a device, through dev_read_alias_seq(). A driver that has to know > the number of a node it does not own, one it reached through a phandle > for instance, has no livetree call for it and is left with fdtdec. > > Move the body of dev_read_alias_seq() to the ofnode level and let both > of its variants call it. The flat lookup reads the tree the node belongs > to instead of gd->fdt_blob. The live lookup covered the control tree > only, as of_alias_scan() builds its table from that tree; a node of > another tree is now looked up in the /aliases node of its own tree. The > stem must match the alias exactly, which the previous patch makes the > flat lookup do as well. > > Tests check the lookup on the live and on the flat tree, with a stem > that is only a prefix of an alias, and on another tree. > > Signed-off-by: Mehmet Fide <[email protected]> > > arch/sandbox/dts/other.dts | 5 +++++ > drivers/core/of_access.c | 42 +++++++++++++++++++++++++++++++++++++++ > drivers/core/ofnode.c | 20 +++++++++++++++++++ > drivers/core/read.c | 20 ++----------------- > include/dm/of_access.h | 7 +++++-- > include/dm/ofnode.h | 16 +++++++++++++++ > include/dm/read.h | 8 ++------ > test/dm/ofnode.c | 49 > ++++++++++++++++++++++++++++++++++++++++++++++ > 8 files changed, 141 insertions(+), 26 deletions(-)
Reviewed-by: Simon Glass <[email protected]>
