summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/shim/src/gpio.c')
-rw-r--r--zephyr/shim/src/gpio.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c
index 020cb54d31..37cfe3e3b4 100644
--- a/zephyr/shim/src/gpio.c
+++ b/zephyr/shim/src/gpio.c
@@ -27,13 +27,17 @@ struct gpio_config {
gpio_flags_t init_flags;
};
-#define GPIO_CONFIG(id) \
- { \
- .name = DT_LABEL(id), \
- .dev_name = DT_LABEL(DT_PHANDLE(id, gpios)), \
- .pin = DT_GPIO_PIN(id, gpios), \
- .init_flags = DT_GPIO_FLAGS(id, gpios), \
- },
+#define GPIO_CONFIG(id) \
+ COND_CODE_1( \
+ DT_NODE_HAS_PROP(id, enum_name), \
+ ( \
+ { \
+ .name = DT_LABEL(id), \
+ .dev_name = DT_LABEL(DT_PHANDLE(id, gpios)), \
+ .pin = DT_GPIO_PIN(id, gpios), \
+ .init_flags = DT_GPIO_FLAGS(id, gpios), \
+ }, ), \
+ ())
static const struct gpio_config configs[] = {
#if DT_NODE_EXISTS(DT_PATH(named_gpios))
DT_FOREACH_CHILD(DT_PATH(named_gpios), GPIO_CONFIG)
@@ -46,7 +50,7 @@ struct gpio_data {
const struct device *dev;
};
-#define GPIO_DATA(id) {},
+#define GPIO_DATA(id) COND_CODE_1(DT_NODE_HAS_PROP(id, enum_name), ({}, ), ())
static struct gpio_data data[] = {
#if DT_NODE_EXISTS(DT_PATH(named_gpios))
DT_FOREACH_CHILD(DT_PATH(named_gpios), GPIO_DATA)