Skip to content

Commit

Permalink
pipeline: (cosmetic) extract code fragment into a function
Browse files Browse the repository at this point in the history
Extract code to obtain a pointer to the module base configuration,
depending on its type, into a separate function.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Aug 13, 2024
1 parent 118cf46 commit 646c9b0
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/audio/pipeline/pipeline-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,17 @@ static void pipeline_trigger_xrun(struct pipeline *p, struct comp_dev **host)
}

#if CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL
static struct ipc4_base_module_cfg *ipc4_get_base_cfg(struct comp_dev *comp)
{
if (comp->drv->type != SOF_COMP_MODULE_ADAPTER)
return comp_get_drvdata(comp);

struct processing_module *mod = comp_mod(comp);
struct module_data *md = &mod->priv;

return &md->cfg.base_cfg;
}

static int pipeline_calc_cps_consumption(struct comp_dev *current,
struct comp_buffer *calling_buf,
struct pipeline_walk_context *ctx, int dir)
Expand All @@ -333,14 +344,7 @@ static int pipeline_calc_cps_consumption(struct comp_dev *current,
comp_core = current->ipc_config.core;

/* modules created through module adapter have different priv_data */
if (current->drv->type != SOF_COMP_MODULE_ADAPTER) {
cd = comp_get_drvdata(current);
} else {
struct processing_module *mod = comp_mod(current);
struct module_data *md = &mod->priv;

cd = &md->cfg.base_cfg;
}
cd = ipc4_get_base_cfg(current);

if (cd->cpc == 0) {
/* Use maximum clock budget, assume 1ms chunk size */
Expand Down

0 comments on commit 646c9b0

Please sign in to comment.