Skip to content

Commit 2da83db

Browse files
committed
include: zephyr: drivers: adc.h: Replace FOREACH with CHILD_BY_REG_ADDR
The macro to initialise a struct adc_dt_spec instance uses a FOREACH macro, which can be problematic when nesting in other FOREACH macros, for example in driver implementations. Replace it with DT_CHILD_BY_REG_ADDR. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent c119467 commit 2da83db

File tree

1 file changed

+1
-4
lines changed
  • include/zephyr/drivers

1 file changed

+1
-4
lines changed

include/zephyr/drivers/adc.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,7 @@ struct adc_dt_spec {
340340
}
341341

342342
#define ADC_CHANNEL_DT_NODE(ctlr, input) \
343-
DT_FOREACH_CHILD_VARGS(ctlr, ADC_FOREACH_INPUT, input)
344-
345-
#define ADC_FOREACH_INPUT(node, input) \
346-
IF_ENABLED(IS_EQ(DT_REG_ADDR_RAW(node), input), (node))
343+
DT_CHILD_BY_REG_ADDR(ctlr, 0, input)
347344

348345
#define ADC_CHANNEL_CFG_FROM_DT_NODE(node_id) \
349346
IF_ENABLED(DT_NODE_EXISTS(node_id), \

0 commit comments

Comments
 (0)