From acfb87dca3e422a07acdd23a72e317a7d3dc59f4 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Tue, 23 Jan 2024 16:55:24 +0800 Subject: [PATCH] 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 --- include/zephyr/devicetree.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 720aea696285..483a659f46ca 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -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 @@ -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) @@ -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