]> git.dujemihanovic.xyz Git - u-boot.git/commit
dm: core: ofnode: Avoid multiple calls to ofnode_get_parent()
authorJonas Karlman <jonas@kwiboo.se>
Sun, 4 Aug 2024 15:05:50 +0000 (15:05 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 27 Aug 2024 20:32:49 +0000 (14:32 -0600)
commit445406afbba6182a9fc46de1b260359e6bc69a0a
tree00a1521b6e9ced5f06e78c0344d88a1a15d7057c
parentd6330529a57288c4ef37e6c23986015738e87063
dm: core: ofnode: Avoid multiple calls to ofnode_get_parent()

Until a live tree is used in U-Boot proper after relocation, use of
ofnode_get_parent() will trigger a call to the very expensive
fdt_parent_offset() as detailed by the function documentation:

  NOTE: This function is expensive, as it must scan the device tree
  structure from the start to nodeoffset, *twice*.

Re-use the returned value from a single call instead of having to make
multiple calls for same node.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/core/ofnode.c