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>
This commit is contained in:
parent
763a9433a7
commit
87e1743ae0
46 changed files with 571 additions and 1301 deletions
|
@ -779,46 +779,4 @@ DEVICE_AND_API_INIT(uart_stm32_##index, DT_INST_LABEL(index),\
|
|||
\
|
||||
STM32_UART_IRQ_HANDLER(index)
|
||||
|
||||
#if DT_HAS_DRV_INST(0)
|
||||
STM32_UART_INIT(0)
|
||||
#endif /* DT_HAS_DRV_INST(0) */
|
||||
|
||||
#if DT_HAS_DRV_INST(1)
|
||||
STM32_UART_INIT(1)
|
||||
#endif /* DT_HAS_DRV_INST(1) */
|
||||
|
||||
#if DT_HAS_DRV_INST(2)
|
||||
STM32_UART_INIT(2)
|
||||
#endif /* DT_HAS_DRV_INST(2) */
|
||||
|
||||
#if DT_HAS_DRV_INST(3)
|
||||
STM32_UART_INIT(3)
|
||||
#endif /* DT_HAS_DRV_INST(3) */
|
||||
|
||||
#if DT_HAS_DRV_INST(4)
|
||||
STM32_UART_INIT(4)
|
||||
#endif /* DT_HAS_DRV_INST(4) */
|
||||
|
||||
#if DT_HAS_DRV_INST(5)
|
||||
STM32_UART_INIT(5)
|
||||
#endif /* DT_HAS_DRV_INST(5) */
|
||||
|
||||
#if DT_HAS_DRV_INST(6)
|
||||
STM32_UART_INIT(6)
|
||||
#endif /* DT_HAS_DRV_INST(6) */
|
||||
|
||||
#if DT_HAS_DRV_INST(7)
|
||||
STM32_UART_INIT(7)
|
||||
#endif /* DT_HAS_DRV_INST(7) */
|
||||
|
||||
#if DT_HAS_DRV_INST(8)
|
||||
STM32_UART_INIT(8)
|
||||
#endif /* DT_HAS_DRV_INST(8) */
|
||||
|
||||
#if DT_HAS_DRV_INST(9)
|
||||
STM32_UART_INIT(9)
|
||||
#endif /* DT_HAS_DRV_INST(9) */
|
||||
|
||||
#if DT_HAS_DRV_INST(10)
|
||||
STM32_UART_INIT(10)
|
||||
#endif /* DT_HAS_DRV_INST(10) */
|
||||
DT_INST_FOREACH(STM32_UART_INIT)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue