Skip to content

Commit bd1a749

Browse files
author
Jyri Sarha
committed
copier: ipc_gtw conversion
1 parent 4239e88 commit bd1a749

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

src/audio/copier/copier.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ __cold static int copier_init(struct processing_module *mod)
232232
#if CONFIG_IPC4_GATEWAY
233233
case ipc4_ipc_output_class:
234234
case ipc4_ipc_input_class:
235-
ret = copier_ipcgtw_create(dev, cd, copier, ipc_pipe->pipeline);
235+
ret = copier_ipcgtw_create(mod, cd, copier, ipc_pipe->pipeline);
236236
if (ret < 0) {
237237
comp_err(dev, "unable to create IPC gateway");
238238
return ret;

src/audio/copier/copier_ipcgtw.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//
33
// Copyright 2023 Intel Corporation. All rights reserved.
44

5+
#include <sof/audio/module_adapter/module/generic.h>
56
#include <sof/audio/component_ext.h>
67
#include <sof/trace/trace.h>
78
#include <sof/lib/memory.h>
@@ -207,15 +208,15 @@ void copier_ipcgtw_reset(struct comp_dev *dev)
207208
}
208209
}
209210

210-
__cold int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,
211+
__cold int copier_ipcgtw_create(struct processing_module *mod, struct copier_data *cd,
211212
const struct ipc4_copier_module_cfg *copier,
212213
struct pipeline *pipeline)
213214
{
215+
struct comp_dev *dev = mod->dev;
214216
struct comp_ipc_config *config = &dev->ipc_config;
215217
struct ipcgtw_data *ipcgtw_data;
216218
const struct ipc4_copier_gateway_cfg *gtw_cfg;
217219
const struct ipc4_ipc_gateway_config_blob *blob;
218-
int ret;
219220

220221
assert_can_be_cold();
221222

@@ -231,7 +232,7 @@ __cold int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,
231232
config->type = SOF_COMP_HOST;
232233
cd->gtw_type = ipc4_gtw_host;
233234

234-
ipcgtw_data = rzalloc(SOF_MEM_FLAG_USER, sizeof(*ipcgtw_data));
235+
ipcgtw_data = mod_zalloc(mod, sizeof(*ipcgtw_data));
235236
if (!ipcgtw_data)
236237
return -ENOMEM;
237238

@@ -254,8 +255,7 @@ __cold int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,
254255
if (!cd->converter[IPC4_COPIER_GATEWAY_PIN]) {
255256
comp_err(dev, "failed to get converter for IPC gateway, dir %d",
256257
cd->direction);
257-
ret = -EINVAL;
258-
goto e_ipcgtw;
258+
return -EINVAL;
259259
}
260260

261261
if (cd->direction == SOF_IPC_STREAM_PLAYBACK) {
@@ -271,16 +271,11 @@ __cold int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,
271271
cd->endpoint_num++;
272272

273273
return 0;
274-
275-
e_ipcgtw:
276-
rfree(ipcgtw_data);
277-
return ret;
278274
}
279275

280276
__cold void copier_ipcgtw_free(struct copier_data *cd)
281277
{
282278
assert_can_be_cold();
283279

284280
list_item_del(&cd->ipcgtw_data->item);
285-
rfree(cd->ipcgtw_data);
286281
}

src/audio/copier/ipcgtw_copier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct ipc4_ipc_gateway_cmd_data_reply {
9595
int copier_ipcgtw_process(const struct ipc4_ipcgtw_cmd *cmd,
9696
void *reply_payload, uint32_t *reply_payload_size);
9797

98-
int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,
98+
int copier_ipcgtw_create(struct processing_module *mod, struct copier_data *cd,
9999
const struct ipc4_copier_module_cfg *copier, struct pipeline *pipeline);
100100

101101
#if CONFIG_IPC4_GATEWAY

0 commit comments

Comments
 (0)