-
Notifications
You must be signed in to change notification settings - Fork 350
Module heap api #10141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module heap api #10141
Changes from 1 commit
065e8ee
9ce9785
90c9ffe
59b7fe7
df29ba2
9d894fb
bf99df9
e6962ff
dd1f009
7b2e881
5832ea5
cb0f95b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,22 +110,22 @@ int module_init(struct processing_module *mod) | |
| return 0; | ||
| } | ||
|
|
||
| void *module_allocate_memory(struct processing_module *mod, uint32_t size, uint32_t alignment) | ||
| void *mod_alloc(struct processing_module *mod, uint32_t size, uint32_t alignment) | ||
| { | ||
| struct comp_dev *dev = mod->dev; | ||
| struct module_memory *container; | ||
| void *ptr; | ||
|
|
||
| if (!size) { | ||
| comp_err(dev, "module_allocate_memory: requested allocation of 0 bytes."); | ||
| comp_err(dev, "mod_alloc: requested allocation of 0 bytes."); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to include the function name in the error message? Zephyr automatically prefixes log entries with the function name.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, but I do not want to mess with this commit that is strictly replace-string operation on the source tree. Maybe I should go through all our modules in another commit, in the next PR.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, now that we are Zephyr only, we should use
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lgirdwood didn't we already conclude that no, we want to keep audio specific macros for audio codes that add audio topology information (component and pipe ids) to the log messages. For generic code outside modules, using plain Zephyr LOG is then ok (when not in module context). |
||
| return NULL; | ||
| } | ||
|
|
||
| /* Allocate memory container */ | ||
| container = rzalloc(SOF_MEM_FLAG_USER, | ||
| sizeof(struct module_memory)); | ||
| if (!container) { | ||
| comp_err(dev, "module_allocate_memory: failed to allocate memory container."); | ||
| comp_err(dev, "mod_alloc: failed to allocate memory container."); | ||
| return NULL; | ||
| } | ||
|
|
||
|
|
@@ -136,7 +136,7 @@ void *module_allocate_memory(struct processing_module *mod, uint32_t size, uint3 | |
| ptr = rballoc(SOF_MEM_FLAG_USER, size); | ||
|
|
||
| if (!ptr) { | ||
| comp_err(dev, "module_allocate_memory: failed to allocate memory for comp %x.", | ||
| comp_err(dev, "mod_alloc: failed to allocate memory for comp %x.", | ||
| dev_comp_id(dev)); | ||
|
jsarha marked this conversation as resolved.
|
||
| return NULL; | ||
| } | ||
|
|
@@ -146,8 +146,9 @@ void *module_allocate_memory(struct processing_module *mod, uint32_t size, uint3 | |
|
|
||
| return ptr; | ||
| } | ||
| EXPORT_SYMBOL(mod_alloc); | ||
|
|
||
| int module_free_memory(struct processing_module *mod, void *ptr) | ||
| int mod_free(struct processing_module *mod, void *ptr) | ||
| { | ||
| struct module_memory *mem; | ||
| struct list_item *mem_list; | ||
|
|
@@ -167,11 +168,12 @@ int module_free_memory(struct processing_module *mod, void *ptr) | |
| } | ||
| } | ||
|
|
||
| comp_err(mod->dev, "module_free_memory: error: could not find memory pointed by %p", | ||
| comp_err(mod->dev, "mod_free: error: could not find memory pointed by %p", | ||
| ptr); | ||
|
|
||
| return -EINVAL; | ||
| } | ||
| EXPORT_SYMBOL(mod_free); | ||
|
|
||
| int module_prepare(struct processing_module *mod, | ||
| struct sof_source **sources, int num_of_sources, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,8 +153,8 @@ struct module_processing_data { | |
| /*****************************************************************************/ | ||
| int module_load_config(struct comp_dev *dev, const void *cfg, size_t size); | ||
| int module_init(struct processing_module *mod); | ||
| void *module_allocate_memory(struct processing_module *mod, uint32_t size, uint32_t alignment); | ||
| int module_free_memory(struct processing_module *mod, void *ptr); | ||
| void *mod_alloc(struct processing_module *mod, uint32_t size, uint32_t alignment); | ||
| int mod_free(struct processing_module *mod, void *ptr); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure we don't have out-of-tree modules that use current generic.h naming? Should we add compatibility macros for the old names?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. out of tree need to adapt. |
||
| void module_free_all_memory(struct processing_module *mod); | ||
| int module_prepare(struct processing_module *mod, | ||
| struct sof_source **sources, int num_of_sources, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commit doesn't say why these are renamed. Just to make them shorter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, simply to make the names shorter and not to trigger line wrapping storm all around the place when all modules are changed to use module API for memory allocations.