devicetree: replace DT_HAS_DRV_INST with DT_INST_FOREACH
Make drivers multi-instance wherever possible using DT_INST_FOREACH.
This allows removing DT_HAS_DRV_INST in favor of making drivers just
do the right thing regardless of how many instances there are.
There are a few exceptions:
- SoC drivers which use CMake input files (like i2c_dw.c) or otherwise
would require more time to convert than I have at the moment. For the
sake of expediency, just inline the DT_HAS_DRV_INST expansion for
now in these cases.
- SoC drivers which are explicitly single-instance (like the nRF SAADC
driver). Again for the sake of expediency, drop a BUILD_ASSERT in
those cases to make sure the assumption that all supported SoCs have
at most one available instance is valid, failing fast otherwise.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
diff --git a/drivers/serial/uart_esp32.c b/drivers/serial/uart_esp32.c
index 27fbb1d..8f1db9d 100644
--- a/drivers/serial/uart_esp32.c
+++ b/drivers/serial/uart_esp32.c
@@ -539,14 +539,4 @@
\
ESP32_UART_IRQ_HANDLER(idx)
-#if DT_HAS_DRV_INST(0)
-ESP32_UART_INIT(0);
-#endif
-
-#if DT_HAS_DRV_INST(1)
-ESP32_UART_INIT(1);
-#endif
-
-#if DT_HAS_DRV_INST(2)
-ESP32_UART_INIT(2);
-#endif
+DT_INST_FOREACH(ESP32_UART_INIT)