From 110d3d92bb498fe9c32c236a2aeae0d336457f75 Mon Sep 17 00:00:00 2001 From: Ioannis Papamanoglou Date: Thu, 26 Mar 2020 10:18:53 +0100 Subject: [PATCH] tests: devicetree: use DT_INST_FOREACH Replace manual per-instance macros with DT_INST_FOREACH for TEST_GPIO_INIT test. Signed-off-by: Ioannis Papamanoglou --- tests/lib/devicetree/src/main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/lib/devicetree/src/main.c b/tests/lib/devicetree/src/main.c index 216ed495c42..35217664640 100644 --- a/tests/lib/devicetree/src/main.c +++ b/tests/lib/devicetree/src/main.c @@ -962,6 +962,8 @@ static int test_gpio_init(struct device *dev) } #define INST(num) DT_INST(num, vnd_gpio) +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT vnd_gpio static const struct gpio_driver_api test_api; @@ -983,12 +985,7 @@ static const struct gpio_driver_api test_api; CONFIG_APPLICATION_INIT_PRIORITY, \ &test_api) -#if DT_HAS_NODE(INST(0)) -TEST_GPIO_INIT(0); -#endif -#if DT_HAS_NODE(INST(1)) -TEST_GPIO_INIT(1); -#endif +DT_INST_FOREACH(TEST_GPIO_INIT); static inline struct test_gpio_data *to_data(struct device *dev) {