mirror of https://github.com/thesofproject/sof.git
comp: use comp_alloc in existing components
Replaces the common, required part of the initialization copied by every implementation. Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This commit is contained in:
parent
e66b40a5b4
commit
5f24796630
|
@ -273,13 +273,9 @@ static struct comp_dev *asrc_new(const struct comp_driver *drv,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_asrc));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_asrc));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_asrc);
|
||||
|
||||
asrc = COMP_GET_IPC(dev, sof_ipc_comp_asrc);
|
||||
err = memcpy_s(asrc, sizeof(*asrc), ipc_asrc,
|
||||
|
|
|
@ -135,13 +135,9 @@ static struct comp_dev *dai_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_dbg(&comp_dai, "dai_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_dai));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_dai));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_dai);
|
||||
|
||||
dai = COMP_GET_IPC(dev, sof_ipc_comp_dai);
|
||||
ret = memcpy_s(dai, sizeof(*dai), ipc_dai,
|
||||
|
|
|
@ -78,13 +78,9 @@ static struct comp_dev *dcblock_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_info(&comp_dcblock, "dcblock_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_process));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_process);
|
||||
|
||||
dcblock = COMP_GET_IPC(dev, sof_ipc_comp_process);
|
||||
ret = memcpy_s(dcblock, sizeof(*dcblock), ipc_dcblock,
|
||||
|
|
|
@ -299,13 +299,9 @@ static struct comp_dev *test_keyword_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_info(&comp_keyword, "test_keyword_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_process));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_process);
|
||||
|
||||
keyword = COMP_GET_IPC(dev, sof_ipc_comp_process);
|
||||
ret = memcpy_s(keyword, sizeof(*keyword), ipc_keyword,
|
||||
|
|
|
@ -416,13 +416,9 @@ static struct comp_dev *eq_fir_new(const struct comp_driver *drv,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_process));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_process);
|
||||
|
||||
fir = COMP_GET_IPC(dev, sof_ipc_comp_process);
|
||||
ret = memcpy_s(fir, sizeof(*fir), ipc_fir,
|
||||
|
|
|
@ -522,13 +522,9 @@ static struct comp_dev *eq_iir_new(const struct comp_driver *drv,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_process));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_process);
|
||||
|
||||
iir = COMP_GET_IPC(dev, sof_ipc_comp_process);
|
||||
ret = memcpy_s(iir, sizeof(*iir), ipc_iir,
|
||||
|
|
|
@ -333,13 +333,9 @@ static struct comp_dev *host_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_dbg(&comp_host, "host_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_host));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_host));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_host);
|
||||
|
||||
host = COMP_GET_IPC(dev, sof_ipc_comp_host);
|
||||
ret = memcpy_s(host, sizeof(*host),
|
||||
|
|
|
@ -133,13 +133,9 @@ static struct comp_dev *kpb_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_info(&comp_kpb, "kpb_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_process));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_process);
|
||||
|
||||
ret = memcpy_s(COMP_GET_IPC(dev, sof_ipc_comp_process),
|
||||
sizeof(struct sof_ipc_comp_process),
|
||||
|
|
|
@ -123,13 +123,9 @@ static struct comp_dev *mixer_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_dbg(&comp_mixer, "mixer_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_mixer));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_mixer));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_mixer);
|
||||
|
||||
mixer = COMP_GET_IPC(dev, sof_ipc_comp_mixer);
|
||||
|
||||
|
|
|
@ -89,15 +89,11 @@ static struct comp_dev *mux_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_info(&comp_mux, "mux_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_process));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
|
||||
dev->state = COMP_STATE_INIT;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_process);
|
||||
|
||||
memcpy_s(COMP_GET_IPC(dev, sof_ipc_comp_process),
|
||||
sizeof(struct sof_ipc_comp_process),
|
||||
|
|
|
@ -58,13 +58,9 @@ static struct comp_dev *selector_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_info(&comp_selector, "selector_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_process));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_process);
|
||||
|
||||
ret = memcpy_s(COMP_GET_IPC(dev, sof_ipc_comp_process),
|
||||
sizeof(struct sof_ipc_comp_process), comp,
|
||||
|
|
|
@ -465,13 +465,9 @@ static struct comp_dev *src_new(const struct comp_driver *drv,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_src));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_src));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_src);
|
||||
|
||||
src = COMP_GET_IPC(dev, sof_ipc_comp_src);
|
||||
|
||||
|
|
|
@ -383,13 +383,9 @@ static struct comp_dev *tone_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_info(&comp_tone, "tone_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_tone));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_tone));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_tone);
|
||||
|
||||
tone = COMP_GET_IPC(dev, sof_ipc_comp_tone);
|
||||
ret = memcpy_s(tone, sizeof(*tone), ipc_tone,
|
||||
|
|
|
@ -211,13 +211,9 @@ static struct comp_dev *volume_new(const struct comp_driver *drv,
|
|||
|
||||
comp_cl_dbg(&comp_volume, "volume_new()");
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_volume));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_volume));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
dev->size = COMP_SIZE(struct sof_ipc_comp_volume);
|
||||
|
||||
vol = COMP_GET_IPC(dev, sof_ipc_comp_volume);
|
||||
ret = memcpy_s(vol, sizeof(*vol), ipc_vol,
|
||||
|
|
|
@ -422,11 +422,9 @@ static struct comp_dev *file_new(const struct comp_driver *drv,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dev = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
|
||||
COMP_SIZE(struct sof_ipc_comp_file));
|
||||
dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_file));
|
||||
if (!dev)
|
||||
return NULL;
|
||||
dev->drv = drv;
|
||||
|
||||
file = COMP_GET_IPC(dev, sof_ipc_comp_file);
|
||||
assert(!memcpy_s(file, sizeof(*file), ipc_file,
|
||||
|
|
Loading…
Reference in New Issue