drivers: dma: dma_stm32: can't use device_get_binding() during init

Not possible to use device_get_binding() because we are
currently initializing DMA_1 device, so it is not ready and
device_get_binding() will fail.
Directly use string compare is more efficient.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
This commit is contained in:
Alexandre Bourdiol 2020-09-08 14:33:50 +02:00 committed by Maureen Helm
parent d58841a1bd
commit 4dbd96900d

View file

@ -594,8 +594,8 @@ static int dma_stm32_init(const struct device *dev)
config->config_irq(dev);
#ifdef CONFIG_DMAMUX_STM32
int offset = ((dev == device_get_binding((const char *)"DMA_1"))
? 0 : config->max_streams);
int offset = (strncmp(dev->name, "DMA_1", 5)
? config->max_streams : 0);
#endif /* CONFIG_DMAMUX_STM32 */
for (uint32_t i = 0; i < config->max_streams; i++) {