devicetree: add DT_PARENT()

This macro takes a node identifier, and returns the parent node's
identifier.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-04-08 15:04:15 -07:00 committed by Kumar Gala
commit 6e27343e7b
4 changed files with 47 additions and 3 deletions

View file

@ -212,6 +212,26 @@
*/
#define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
/**
* @brief Get a node identifier for a parent node
*
* Example devicetree fragment:
*
* parent: parent-node {
* child: child-node {
* ...
* };
* };
*
* The following generate equivalent node identifiers:
*
* DT_NODELABEL(parent)
* DT_PARENT(DT_NODELABEL(child))
*
* @param node_id node identifier
*/
#define DT_PARENT(node_id) UTIL_CAT(node_id, _PARENT)
/**
* @brief Get a node identifier for a child node
*