kernel: subsys: lib: drivers: Use k_heap instead of z_mem_pool wrappers
Use the core k_heap API pervasively within our tree instead of the z_mem_pool wrapper that provided compatibility with the older mempool implementation. Almost all of this is straightforward swapping of one alloc/free call for another. In a few cases where code was holding onto an old-style "mem_block" a local compatibility struct with a single field has been swapped in to keep the invasiveness of the changes down. Note that not all the relevant changes in this patch have in-tree test coverage, though I validated that it all builds. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
78614bf271
commit
fcd392f6ce
25 changed files with 137 additions and 207 deletions
|
@ -17,11 +17,9 @@
|
|||
|
||||
LOG_MODULE_REGISTER(display_mcux_elcdif, CONFIG_DISPLAY_LOG_LEVEL);
|
||||
|
||||
K_MEM_POOL_DEFINE(mcux_elcdif_pool,
|
||||
CONFIG_MCUX_ELCDIF_POOL_BLOCK_MIN,
|
||||
CONFIG_MCUX_ELCDIF_POOL_BLOCK_MAX,
|
||||
CONFIG_MCUX_ELCDIF_POOL_BLOCK_NUM,
|
||||
CONFIG_MCUX_ELCDIF_POOL_BLOCK_ALIGN);
|
||||
K_HEAP_DEFINE(mcux_elcdif_pool,
|
||||
CONFIG_MCUX_ELCDIF_POOL_BLOCK_MAX *
|
||||
CONFIG_MCUX_ELCDIF_POOL_BLOCK_NUM);
|
||||
|
||||
struct mcux_elcdif_config {
|
||||
LCDIF_Type *base;
|
||||
|
@ -31,8 +29,12 @@ struct mcux_elcdif_config {
|
|||
uint8_t bits_per_pixel;
|
||||
};
|
||||
|
||||
struct mcux_mem_block {
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct mcux_elcdif_data {
|
||||
struct k_mem_block fb[2];
|
||||
struct mcux_mem_block fb[2];
|
||||
struct k_sem sem;
|
||||
size_t pixel_bytes;
|
||||
size_t fb_bytes;
|
||||
|
@ -190,8 +192,10 @@ static int mcux_elcdif_init(const struct device *dev)
|
|||
data->write_idx = 1U;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(data->fb); i++) {
|
||||
if (k_mem_pool_alloc(&mcux_elcdif_pool, &data->fb[i],
|
||||
data->fb_bytes, K_NO_WAIT) != 0) {
|
||||
data->fb[i].data = k_heap_alloc(&mcux_elcdif_pool,
|
||||
&data->fb[i],
|
||||
data->fb_bytes, K_NO_WAIT);
|
||||
if (data->fb[i] == NULL) {
|
||||
LOG_ERR("Could not allocate frame buffer %d", i);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue