From 098be726f5d0a39cdecd747b69fa144e95b56756 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 24 Dec 2023 12:46:35 +0900 Subject: [PATCH] drivers: gpio: ra: Fix error on nodes without interruptible pin 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 --- drivers/gpio/gpio_ra.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio_ra.c b/drivers/gpio/gpio_ra.c index 9f4fe59c83b1f16..42533b4a0391afb 100644 --- a/drivers/gpio/gpio_ra.c +++ b/drivers/gpio/gpio_ra.c @@ -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), \