devicetree.h: Covert DT_{REG,IRQ}_HAS_IDX macros to IS_ENABLED form

With the generation of DT_N_<node-id>_{REG,IRQ}_IDX_<idx>_EXISTS
defines, we can now use the IS_ENABLED macro to implement DT_REG_HAS_IDX
and DT_IRQ_HAS_IDX.  This matches how other DT_*_HAS_* macros are
implemented as well as lets us utilize these macros with COND_CODE_1.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-04-14 14:32:02 -05:00 committed by Kumar Gala
commit df174ded13

View file

@ -655,7 +655,8 @@
* @return 1 if "idx" is a valid register block index,
* 0 otherwise.
*/
#define DT_REG_HAS_IDX(node_id, idx) ((idx) < DT_NUM_REGS(node_id))
#define DT_REG_HAS_IDX(node_id, idx) \
IS_ENABLED(DT_CAT(node_id, _REG_IDX_##idx##_EXISTS))
/**
* @brief Get the base address of the register block at index "idx"
@ -740,7 +741,8 @@
* @return 1 if the idx is valid for the interrupt property
* 0 otherwise.
*/
#define DT_IRQ_HAS_IDX(node_id, idx) ((idx) < DT_NUM_IRQS(node_id))
#define DT_IRQ_HAS_IDX(node_id, idx) \
IS_ENABLED(DT_CAT(node_id, _IRQ_IDX_##idx##_EXISTS))
/**
* @brief Get a value within an interrupt specifier at an index