dts: add a function to find/create node by string path

The existing device tree API requires the node path in the device tree
represented as an array of node names. Sometimes it is more convenient
to have the path represented by a string with nodes separated by '/'
characters.

This change also removes the assumption that the string passed to
dt_find_node() if immutable, so this function now creates duplicates
of the names of the nodes it creates.

In the event of strdup() in dt_find_node() failing, the allocated node
will be left dangling, as there is no API to release a node container.

BRANCH=storm
BUG=chrome-os-partner:32611
TEST=tested with the next patch applied (copying calibration data from
     CBMEM to the device tree)

Change-Id: I6d8563686ac9d1b7d242365b6b0e4d50cb4c51c8
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225441
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2 files changed