Skip to content

Commit

Permalink
devicetree: reuse DT_CAT* instead of pasting manually
Browse files Browse the repository at this point in the history
Reuse `DT_CAT*` macros to paste these things together instead
of pasting manually.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
  • Loading branch information
ycsin authored and cfriedt committed Jan 25, 2024
1 parent f64af1a commit acfb87d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/zephyr/devicetree.h
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@
* @return the property's value as a sequence of tokens, with no quotes
*/
#define DT_STRING_UNQUOTED_BY_IDX(node_id, prop, idx) \
DT_CAT4(node_id, _P_, prop##_IDX_##idx, _STRING_UNQUOTED)
DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UNQUOTED)

/*
* phandle properties
Expand Down Expand Up @@ -1383,7 +1383,7 @@
* @return the cell's value or @p default_value
*/
#define DT_PHA_BY_IDX_OR(node_id, pha, idx, cell, default_value) \
DT_PROP_OR(node_id, pha##_IDX_##idx##_VAL_##cell, default_value)
DT_PROP_OR(node_id, DT_CAT5(pha, _IDX_, idx, _VAL_, cell), default_value)

/**
* @brief Equivalent to DT_PHA_BY_IDX(node_id, pha, 0, cell)
Expand Down Expand Up @@ -1476,7 +1476,7 @@
* @return the cell's value or @p default_value
*/
#define DT_PHA_BY_NAME_OR(node_id, pha, name, cell, default_value) \
DT_PROP_OR(node_id, pha##_NAME_##name##_VAL_##cell, default_value)
DT_PROP_OR(node_id, DT_CAT5(pha, _NAME_, name, _VAL_, cell), default_value)

/**
* @brief Get a phandle's node identifier from a phandle array by @p name
Expand Down

0 comments on commit acfb87d

Please sign in to comment.