Skip to content

Commit acfb87d

Browse files
ycsincfriedt
authored andcommitted
devicetree: reuse DT_CAT* instead of pasting manually
Reuse `DT_CAT*` macros to paste these things together instead of pasting manually. Signed-off-by: Yong Cong Sin <[email protected]>
1 parent f64af1a commit acfb87d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/zephyr/devicetree.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@
12081208
* @return the property's value as a sequence of tokens, with no quotes
12091209
*/
12101210
#define DT_STRING_UNQUOTED_BY_IDX(node_id, prop, idx) \
1211-
DT_CAT4(node_id, _P_, prop##_IDX_##idx, _STRING_UNQUOTED)
1211+
DT_CAT6(node_id, _P_, prop, _IDX_, idx, _STRING_UNQUOTED)
12121212

12131213
/*
12141214
* phandle properties
@@ -1383,7 +1383,7 @@
13831383
* @return the cell's value or @p default_value
13841384
*/
13851385
#define DT_PHA_BY_IDX_OR(node_id, pha, idx, cell, default_value) \
1386-
DT_PROP_OR(node_id, pha##_IDX_##idx##_VAL_##cell, default_value)
1386+
DT_PROP_OR(node_id, DT_CAT5(pha, _IDX_, idx, _VAL_, cell), default_value)
13871387

13881388
/**
13891389
* @brief Equivalent to DT_PHA_BY_IDX(node_id, pha, 0, cell)
@@ -1476,7 +1476,7 @@
14761476
* @return the cell's value or @p default_value
14771477
*/
14781478
#define DT_PHA_BY_NAME_OR(node_id, pha, name, cell, default_value) \
1479-
DT_PROP_OR(node_id, pha##_NAME_##name##_VAL_##cell, default_value)
1479+
DT_PROP_OR(node_id, DT_CAT5(pha, _NAME_, name, _VAL_, cell), default_value)
14801480

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

0 commit comments

Comments
 (0)