Skip to content

Commit

Permalink
drivers: gpio: ra: Fix error on nodes without interruptible pin
Browse files Browse the repository at this point in the history
The macro resolving will fail with gpio nodes with no
`interrupt_names` definition.
Add a conditional branch to avoid calling the macro if
`interrupt_names` is not defined.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
  • Loading branch information
soburi committed Dec 24, 2023
1 parent 8bdb06e commit 098be72
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/gpio/gpio_ra.c
Expand Up @@ -414,10 +414,13 @@ static const struct gpio_driver_api gpio_ra_driver_api = {

#define GPIO_RA_INIT(idx) \
static struct gpio_ra_data gpio_ra_data_##idx = {}; \
DT_INST_FOREACH_PROP_ELEM(idx, interrupt_names, GPIO_RA_DECL_PINS); \
DT_INST_FOREACH_PROP_ELEM(idx, interrupt_names, GPIO_RA_ISR_DECL); \
struct gpio_ra_irq_info gpio_ra_irq_info_##idx[] = { \
DT_INST_FOREACH_PROP_ELEM(idx, interrupt_names, GPIO_RA_IRQ_INFO)}; \
IF_ENABLED(DT_INST_NODE_HAS_PROP(idx, interrupt_names), \
(DT_INST_FOREACH_PROP_ELEM(idx, interrupt_names, GPIO_RA_DECL_PINS); \
DT_INST_FOREACH_PROP_ELEM(idx, interrupt_names, GPIO_RA_ISR_DECL);)) \
static struct gpio_ra_irq_info gpio_ra_irq_info_##idx[] = { \
IF_ENABLED(DT_INST_NODE_HAS_PROP(idx, interrupt_names), \
(DT_INST_FOREACH_PROP_ELEM(idx, interrupt_names, GPIO_RA_IRQ_INFO))) \
}; \
static struct gpio_ra_config gpio_ra_config_##idx = { \
.common = { \
.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(idx), \
Expand Down

0 comments on commit 098be72

Please sign in to comment.