gpio: Fix GPIO_DT_SPEC_INST_GET_BY_IDX_OR macro
Fixes the macro for getting the instance of a device tree GPIO
with index or default value.
@@ -389,7 +389,9 @@ struct gpio_dt_spec {
* @see GPIO_DT_SPEC_GET_BY_IDX()
*/
#define GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, prop, idx, default_value) \
- GPIO_DT_SPEC_GET_BY_IDX_OR(DT_DRV_INST(inst), prop, idx, default_value)
+ COND_CODE_1(DT_PROP_HAS_IDX(DT_DRV_INST(inst), prop, idx), \
+ (GPIO_DT_SPEC_GET_BY_IDX(DT_DRV_INST(inst), prop, idx)), \
+ (default_value))
/**
* @brief Equivalent to GPIO_DT_SPEC_INST_GET_BY_IDX(inst, prop, 0).
