Skip to content

Commit 4e8b382

Browse files
mbolivar-nordicnashif
authored andcommitted
soc: nrf: fix NRF_DT_CHECK_GPIO_CTLR_IS_SOC
This was merged by mistake without being tested and is not working properly. We need to avoid doing a BUILD_ASSERT() when the relevant property is missing, because we can't use DT_GPIO_CTLR() on an undefined property. Handle this with COND_CODE_1(). Signed-off-by: Martí Bolívar <[email protected]>
1 parent b026360 commit 4e8b382

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

soc/arm/nordic_nrf/soc_nrf_common.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,23 @@
6666
* @param prop_name human-readable string name for 'prop'
6767
*/
6868
#define NRF_DT_CHECK_GPIO_CTLR_IS_SOC(node_id, prop, prop_name) \
69-
BUILD_ASSERT(!DT_NODE_HAS_PROP(node_id, prop) || \
70-
DT_NODE_HAS_COMPAT(DT_GPIO_CTLR(node_id, prop), \
71-
nordic_nrf_gpio), \
72-
"Devicetree node " DT_NODE_PATH(node_id) \
73-
" property " prop_name " must refer to a GPIO " \
74-
" controller with compatible nordic,nrf-gpio; " \
75-
"got " DT_NODE_PATH(DT_GPIO_CTLR(node_id, prop)) \
76-
", which does not have this compatible")
69+
COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
70+
(BUILD_ASSERT(DT_NODE_HAS_COMPAT( \
71+
DT_GPIO_CTLR(node_id, prop), \
72+
nordic_nrf_gpio), \
73+
"Devicetree node " \
74+
DT_NODE_PATH(node_id) \
75+
" property " prop_name \
76+
" must refer to a GPIO controller " \
77+
"with compatible nordic,nrf-gpio; " \
78+
"got " \
79+
DT_NODE_PATH(DT_GPIO_CTLR(node_id, \
80+
prop)) \
81+
", which does not have this " \
82+
"compatible")), \
83+
(BUILD_ASSERT(1, \
84+
"NRF_DT_CHECK_GPIO_CTLR_IS_SOC: OK")))
85+
/* Note: allow a trailing ";" either way */
7786

7887
#endif /* !_ASMLANGUAGE */
7988

0 commit comments

Comments
 (0)