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:
Andy Ross 2020-12-07 05:53:28 -08:00 committed by Anas Nashif
commit fcd392f6ce
25 changed files with 137 additions and 207 deletions

View file

@ -20,9 +20,7 @@
#endif
Z_MEM_POOL_DEFINE(gcov_heap_mem_pool,
MALLOC_MIN_BLOCK_SIZE,
MALLOC_MAX_HEAP_SIZE, 1, 4);
K_HEAP_DEFINE(gcov_heap, MALLOC_MAX_HEAP_SIZE);
static struct gcov_info *gcov_info_head;
@ -233,7 +231,7 @@ void gcov_coverage_dump(void)
size = calculate_buff_size(gcov_list);
buffer = (uint8_t *) z_mem_pool_malloc(&gcov_heap_mem_pool, size);
buffer = k_heap_alloc(&gcov_heap, size, K_NO_WAIT);
if (!buffer) {
printk("No Mem available to continue dump\n");
goto coverage_dump_end;
@ -247,7 +245,7 @@ void gcov_coverage_dump(void)
dump_on_console(gcov_list->filename, buffer, size);
k_free(buffer);
k_heap_free(&gcov_heap, buffer);
gcov_list = gcov_list->next;
}
coverage_dump_end: