devicetree: fix DT_NUM_INST() when the answer is 0
Use UTIL_AND() so it works even when there are no instances. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
fb1e7a563c
commit
9d15e98643
2 changed files with 8 additions and 3 deletions
|
@ -851,7 +851,9 @@
|
|||
* @param compat lowercase-and-underscores version of a compatible
|
||||
* @return Number of enabled instances
|
||||
*/
|
||||
#define DT_NUM_INST(compat) UTIL_CAT(DT_N_INST, DT_DASH(compat, NUM))
|
||||
#define DT_NUM_INST(compat) \
|
||||
UTIL_AND(DT_HAS_COMPAT(compat), \
|
||||
UTIL_CAT(DT_N_INST, DT_DASH(compat, NUM)))
|
||||
|
||||
/**
|
||||
* @brief Test if the devicetree has a /chosen node
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue