drivers: dmamux: Remove need for kmalloc

Use file static variable for the channel config data, instead
of a dynamic array allocated with kmalloc.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
This commit is contained in:
Erwin Rol 2020-09-04 23:32:02 +02:00 committed by Anas Nashif
commit 4cc15d73dd

View file

@ -172,13 +172,6 @@ static int dmamux_stm32_init(const struct device *dev)
return -EIO;
}
int size_stream =
sizeof(struct dmamux_stm32_channel) * config->channel_nb;
data->mux_channels = k_malloc(size_stream);
if (!data->mux_channels) {
LOG_ERR("HEAP_MEM_POOL_SIZE is too small");
return -ENOMEM;
}
for (int i = 0; i < config->channel_nb; i++) {
/*
* associates the dmamux channel
@ -220,8 +213,11 @@ const struct dmamux_stm32_config dmamux_stm32_config_##index = {\
.req_nb = DT_INST_PROP(index, dma_requests), \
}; \
\
static struct dmamux_stm32_channel \
dmamux_stm32_channels_##index[DT_INST_PROP(index, dma_channels)]; \
\
static struct dmamux_stm32_data dmamux_stm32_data_##index = { \
.mux_channels = NULL, \
.mux_channels = dmamux_stm32_channels_##index, \
}; \
\
DEVICE_DT_INST_DEFINE(index, \