Skip to content

Commit 6471671

Browse files
author
Jyri Sarha
committed
modules: Rename module_allocate_memory and module_free_memory
Rename module_allocate_memory and module_free_memory to mod_alloc and mod_free. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 800f6ce commit 6471671

5 files changed

Lines changed: 31 additions & 31 deletions

File tree

src/audio/codec/dts/dts.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static void *dts_effect_allocate_codec_memory(void *mod_void, unsigned int lengt
2525

2626
comp_dbg(dev, "dts_effect_allocate_codec_memory() start");
2727

28-
pMem = module_allocate_memory(mod, (uint32_t)length, (uint32_t)alignment);
28+
pMem = mod_alloc(mod, (uint32_t)length, (uint32_t)alignment);
2929

3030
if (pMem == NULL)
3131
comp_err(dev,
@@ -42,10 +42,10 @@ static void dts_effect_free_codec_memory(void *mod_void, void *pMem)
4242

4343
comp_dbg(dev, "dts_effect_free_codec_memory() start");
4444

45-
int ret = module_free_memory(mod, pMem);
45+
int ret = mod_free(mod, pMem);
4646

4747
if (ret)
48-
comp_err(dev, "dts_effect_free_codec_memory() module_free_memory failed %d", ret);
48+
comp_err(dev, "dts_effect_free_codec_memory() mod_free failed %d", ret);
4949

5050
comp_dbg(dev, "dts_effect_free_codec_memory() done");
5151
}

src/audio/module_adapter/module/cadence.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ static int init_memory_tables(struct processing_module *mod)
519519
goto err;
520520
}
521521
/* Allocate memory for this type, taking alignment into account */
522-
ptr = module_allocate_memory(mod, mem_size, mem_alignment);
522+
ptr = mod_alloc(mod, mem_size, mem_alignment);
523523
if (!ptr) {
524524
comp_err(dev, "init_memory_tables() error %x: failed to allocate memory for %d",
525525
ret, mem_type);
@@ -563,13 +563,13 @@ static int init_memory_tables(struct processing_module *mod)
563563
return 0;
564564
err:
565565
if (scratch)
566-
module_free_memory(mod, scratch);
566+
mod_free(mod, scratch);
567567
if (persistent)
568-
module_free_memory(mod, persistent);
568+
mod_free(mod, persistent);
569569
if (codec->mpd.in_buff)
570-
module_free_memory(mod, codec->mpd.in_buff);
570+
mod_free(mod, codec->mpd.in_buff);
571571
if (codec->mpd.out_buff)
572-
module_free_memory(mod, codec->mpd.out_buff);
572+
mod_free(mod, codec->mpd.out_buff);
573573
return ret;
574574
}
575575

@@ -688,7 +688,7 @@ static int cadence_codec_prepare(struct processing_module *mod,
688688
return ret;
689689
}
690690

691-
cd->mem_tabs = module_allocate_memory(mod, mem_tabs_size, 4);
691+
cd->mem_tabs = mod_alloc(mod, mem_tabs_size, 4);
692692
if (!cd->mem_tabs) {
693693
comp_err(dev, "cadence_codec_prepare() error: failed to allocate space for memtabs");
694694
return -ENOMEM;
@@ -732,7 +732,7 @@ static int cadence_codec_prepare(struct processing_module *mod,
732732
comp_dbg(dev, "cadence_codec_prepare() done");
733733
return 0;
734734
free:
735-
module_free_memory(mod, cd->mem_tabs);
735+
mod_free(mod, cd->mem_tabs);
736736
return ret;
737737
}
738738

src/audio/module_adapter/module/generic.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,22 @@ int module_init(struct processing_module *mod)
110110
return 0;
111111
}
112112

113-
void *module_allocate_memory(struct processing_module *mod, uint32_t size, uint32_t alignment)
113+
void *mod_alloc(struct processing_module *mod, uint32_t size, uint32_t alignment)
114114
{
115115
struct comp_dev *dev = mod->dev;
116116
struct module_memory *container;
117117
void *ptr;
118118

119119
if (!size) {
120-
comp_err(dev, "module_allocate_memory: requested allocation of 0 bytes.");
120+
comp_err(dev, "mod_alloc: requested allocation of 0 bytes.");
121121
return NULL;
122122
}
123123

124124
/* Allocate memory container */
125125
container = rzalloc(SOF_MEM_FLAG_USER,
126126
sizeof(struct module_memory));
127127
if (!container) {
128-
comp_err(dev, "module_allocate_memory: failed to allocate memory container.");
128+
comp_err(dev, "mod_alloc: failed to allocate memory container.");
129129
return NULL;
130130
}
131131

@@ -136,7 +136,7 @@ void *module_allocate_memory(struct processing_module *mod, uint32_t size, uint3
136136
ptr = rballoc(SOF_MEM_FLAG_USER, size);
137137

138138
if (!ptr) {
139-
comp_err(dev, "module_allocate_memory: failed to allocate memory for comp %x.",
139+
comp_err(dev, "mod_alloc: failed to allocate memory for comp %x.",
140140
dev_comp_id(dev));
141141
return NULL;
142142
}
@@ -147,7 +147,7 @@ void *module_allocate_memory(struct processing_module *mod, uint32_t size, uint3
147147
return ptr;
148148
}
149149

150-
int module_free_memory(struct processing_module *mod, void *ptr)
150+
int mod_free(struct processing_module *mod, void *ptr)
151151
{
152152
struct module_memory *mem;
153153
struct list_item *mem_list;
@@ -167,7 +167,7 @@ int module_free_memory(struct processing_module *mod, void *ptr)
167167
}
168168
}
169169

170-
comp_err(mod->dev, "module_free_memory: error: could not find memory pointed by %p",
170+
comp_err(mod->dev, "mod_free: error: could not find memory pointed by %p",
171171
ptr);
172172

173173
return -EINVAL;

src/audio/module_adapter/module/waves/waves.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static int waves_effect_allocate(struct processing_module *mod)
200200
return -EINVAL;
201201
}
202202

203-
waves_codec->effect = (MaxxEffect_t *)module_allocate_memory(mod,
203+
waves_codec->effect = (MaxxEffect_t *)mod_alloc(mod,
204204
waves_codec->effect_size, 16);
205205

206206
if (!waves_codec->effect) {
@@ -376,15 +376,15 @@ static int waves_effect_buffers(struct processing_module *mod)
376376

377377
comp_dbg(dev, "waves_effect_buffers() start");
378378

379-
i_buffer = module_allocate_memory(mod, waves_codec->buffer_bytes, 16);
379+
i_buffer = mod_alloc(mod, waves_codec->buffer_bytes, 16);
380380
if (!i_buffer) {
381381
comp_err(dev, "waves_effect_buffers() failed to allocate %d bytes for i_buffer",
382382
waves_codec->buffer_bytes);
383383
ret = -ENOMEM;
384384
goto err;
385385
}
386386

387-
o_buffer = module_allocate_memory(mod, waves_codec->buffer_bytes, 16);
387+
o_buffer = mod_alloc(mod, waves_codec->buffer_bytes, 16);
388388
if (!o_buffer) {
389389
comp_err(dev, "waves_effect_buffers() failed to allocate %d bytes for o_buffer",
390390
waves_codec->buffer_bytes);
@@ -407,9 +407,9 @@ static int waves_effect_buffers(struct processing_module *mod)
407407

408408
err:
409409
if (i_buffer)
410-
module_free_memory(mod, i_buffer);
410+
mod_free(mod, i_buffer);
411411
if (o_buffer)
412-
module_free_memory(mod, o_buffer);
412+
mod_free(mod, o_buffer);
413413
return ret;
414414
}
415415

@@ -475,13 +475,13 @@ static int waves_effect_save_config_blob_to_cache(struct processing_module *mod,
475475
/* release old cached config blob*/
476476
if (waves_codec->config_blob && size != waves_codec->config_blob_size) {
477477
comp_info(dev, "waves_effect_save_config_blob_to_cache() release blob");
478-
module_free_memory(mod, waves_codec->config_blob);
478+
mod_free(mod, waves_codec->config_blob);
479479
waves_codec->config_blob = NULL;
480480
waves_codec->config_blob_size = 0;
481481
}
482482

483483
if (!waves_codec->config_blob) {
484-
waves_codec->config_blob = module_allocate_memory(mod, size, 16);
484+
waves_codec->config_blob = mod_alloc(mod, size, 16);
485485
if (!waves_codec->config_blob) {
486486
comp_err(dev,
487487
"waves_effect_save_config_blob_to_cache() failed to allocate %d bytes for config blob",
@@ -497,7 +497,7 @@ static int waves_effect_save_config_blob_to_cache(struct processing_module *mod,
497497
comp_err(dev,
498498
"waves_effect_save_config_blob_to_cache(): failed to copy config blob %d",
499499
ret);
500-
module_free_memory(mod, waves_codec->config_blob);
500+
mod_free(mod, waves_codec->config_blob);
501501
waves_codec->config_blob = NULL;
502502
waves_codec->config_blob_size = 0;
503503
return ret;
@@ -668,7 +668,7 @@ static int waves_codec_init(struct processing_module *mod)
668668

669669
comp_dbg(dev, "waves_codec_init() start");
670670

671-
waves_codec = module_allocate_memory(mod, sizeof(struct waves_codec_data), 16);
671+
waves_codec = mod_alloc(mod, sizeof(struct waves_codec_data), 16);
672672
if (!waves_codec) {
673673
comp_err(dev, "waves_codec_init() failed to allocate %d bytes for waves_codec_data",
674674
sizeof(struct waves_codec_data));
@@ -678,7 +678,7 @@ static int waves_codec_init(struct processing_module *mod)
678678
codec->private = waves_codec;
679679
ret = waves_effect_allocate(mod);
680680
if (ret) {
681-
module_free_memory(mod, waves_codec);
681+
mod_free(mod, waves_codec);
682682
codec->private = NULL;
683683
}
684684
}
@@ -696,7 +696,7 @@ static int waves_codec_init(struct processing_module *mod)
696696
return -EINVAL;
697697
}
698698

699-
response = module_allocate_memory(mod, waves_codec->response_max_bytes, 16);
699+
response = mod_alloc(mod, waves_codec->response_max_bytes, 16);
700700
if (!response) {
701701
comp_err(dev, "waves_codec_init() failed to allocate %d bytes for response",
702702
waves_codec->response_max_bytes);
@@ -850,10 +850,10 @@ static int waves_codec_reset(struct processing_module *mod)
850850
comp_err(dev, "waves_codec_reset() failed %d", ret);
851851

852852
if (codec->mpd.in_buff)
853-
module_free_memory(mod, codec->mpd.in_buff);
853+
mod_free(mod, codec->mpd.in_buff);
854854

855855
if (codec->mpd.out_buff)
856-
module_free_memory(mod, codec->mpd.out_buff);
856+
mod_free(mod, codec->mpd.out_buff);
857857

858858
waves_codec->initialized = false;
859859
comp_dbg(dev, "waves_codec_reset() done");

src/include/sof/audio/module_adapter/module/generic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ struct module_processing_data {
153153
/*****************************************************************************/
154154
int module_load_config(struct comp_dev *dev, const void *cfg, size_t size);
155155
int module_init(struct processing_module *mod);
156-
void *module_allocate_memory(struct processing_module *mod, uint32_t size, uint32_t alignment);
157-
int module_free_memory(struct processing_module *mod, void *ptr);
156+
void *mod_alloc(struct processing_module *mod, uint32_t size, uint32_t alignment);
157+
int mod_free(struct processing_module *mod, void *ptr);
158158
void module_free_all_memory(struct processing_module *mod);
159159
int module_prepare(struct processing_module *mod,
160160
struct sof_source **sources, int num_of_sources,

0 commit comments

Comments
 (0)