From 1512a49bfad241fb41ec2ff5a8b24c91548415ab Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Wed, 14 Oct 2020 11:12:47 -0700 Subject: [PATCH] component: initialize new devices to INIT state As per component graph we start devices in INIT state. Since most components don't use this state anyways lets just init the struct to this state and remove it where it is used correctly. Signed-off-by: Curtis Malainey --- src/audio/drc/drc.c | 2 -- src/audio/mux/mux.c | 2 -- src/audio/tdfb/tdfb.c | 2 -- src/include/sof/audio/component.h | 1 + 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/audio/drc/drc.c b/src/audio/drc/drc.c index 702b43341..cfde39c80 100644 --- a/src/audio/drc/drc.c +++ b/src/audio/drc/drc.c @@ -167,8 +167,6 @@ static struct comp_dev *drc_new(const struct comp_driver *drv, sizeof(struct sof_ipc_comp_process)); assert(!ret); - dev->state = COMP_STATE_INIT; - cd = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(*cd)); if (!cd) { rfree(dev); diff --git a/src/audio/mux/mux.c b/src/audio/mux/mux.c index 0faa0e371..779a97285 100644 --- a/src/audio/mux/mux.c +++ b/src/audio/mux/mux.c @@ -136,8 +136,6 @@ static struct comp_dev *mux_new(const struct comp_driver *drv, if (!dev) return NULL; - dev->state = COMP_STATE_INIT; - memcpy_s(COMP_GET_IPC(dev, sof_ipc_comp_process), sizeof(struct sof_ipc_comp_process), comp, sizeof(struct sof_ipc_comp_process)); diff --git a/src/audio/tdfb/tdfb.c b/src/audio/tdfb/tdfb.c index 8d3de5696..1cb05d62a 100644 --- a/src/audio/tdfb/tdfb.c +++ b/src/audio/tdfb/tdfb.c @@ -269,8 +269,6 @@ static struct comp_dev *tdfb_new(const struct comp_driver *drv, sizeof(struct sof_ipc_comp_process), ipc_tdfb, sizeof(struct sof_ipc_comp_process)); - dev->state = COMP_STATE_INIT; - cd = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(*cd)); if (!cd) { rfree(dev); diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 7bab687f5..303ff4f3f 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -546,6 +546,7 @@ static inline struct comp_dev *comp_alloc(const struct comp_driver *drv, return NULL; dev->size = bytes; dev->drv = drv; + dev->state = COMP_STATE_INIT; memcpy_s(&dev->tctx, sizeof(struct tr_ctx), trace_comp_drv_get_tr_ctx(dev->drv), sizeof(struct tr_ctx));