Skip to content

Commit

Permalink
pipeline: remove buffer_acquire from pipeline files
Browse files Browse the repository at this point in the history
remove buffer ops from pipeline-graph.c and
pipeline-params.c

this is a continuation of changes
from commit 4a03699

Signed-off-by: Marcin Szkudlinski <[email protected]>
  • Loading branch information
marcinszkudlinski committed Sep 18, 2023
1 parent 090a77d commit 2734113
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
21 changes: 5 additions & 16 deletions src/audio/pipeline/pipeline-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,10 @@ struct pipeline *pipeline_new(uint32_t pipeline_id, uint32_t priority, uint32_t
static void buffer_set_comp(struct comp_buffer *buffer, struct comp_dev *comp,
int dir)
{
struct comp_buffer *buffer_c = buffer_acquire(buffer);

if (dir == PPL_CONN_DIR_COMP_TO_BUFFER)
buffer_c->source = comp;
buffer->source = comp;
else
buffer_c->sink = comp;

buffer_release(buffer_c);
buffer->sink = comp;
}

int pipeline_connect(struct comp_dev *comp, struct comp_buffer *buffer,
Expand Down Expand Up @@ -410,7 +406,6 @@ int pipeline_for_each_comp(struct comp_dev *current,
/* run this operation further */
list_for_item(clist, buffer_list) {
struct comp_buffer *buffer = buffer_from_list(clist, dir);
struct comp_buffer *buffer_c;
struct comp_dev *buffer_comp;
int err = 0;

Expand All @@ -434,28 +429,22 @@ int pipeline_for_each_comp(struct comp_dev *current,

buffer_comp = buffer_get_comp(buffer, dir);

buffer_c = buffer_acquire(buffer);

/* execute operation on buffer */
if (ctx->buff_func)
ctx->buff_func(buffer_c, ctx->buff_data);
ctx->buff_func(buffer, ctx->buff_data);

/* don't go further if this component is not connected */
if (buffer_comp &&
(!ctx->skip_incomplete || buffer_comp->pipeline) &&
ctx->comp_func) {
buffer_c->walking = true;
buffer_release(buffer_c);
buffer->walking = true;

err = ctx->comp_func(buffer_comp, buffer,
ctx, dir);

buffer_c = buffer_acquire(buffer);
buffer_c->walking = false;
buffer->walking = false;
}

buffer_release(buffer_c);

if (err < 0 || err == PPL_STATUS_PATH_STOP)
return err;
}
Expand Down
12 changes: 3 additions & 9 deletions src/audio/pipeline/pipeline-params.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ static int pipeline_comp_params_neg(struct comp_dev *current,
int dir)
{
struct pipeline_data *ppl_data = ctx->comp_data;
struct comp_buffer *buf_c = buffer_acquire(calling_buf);
int err = 0;

pipe_dbg(current->pipeline, "pipeline_comp_params_neg(), current->comp.id = %u, dir = %u",
Expand All @@ -48,12 +47,12 @@ static int pipeline_comp_params_neg(struct comp_dev *current,
* a component who has different channels input/output buffers
* should explicitly configure the channels of the branched buffers.
*/
err = buffer_set_params(buf_c, &ppl_data->params->params,
err = buffer_set_params(calling_buf, &ppl_data->params->params,
BUFFER_UPDATE_FORCE);
break;
default:
/* return 0 if params matches */
if (!buffer_params_match(buf_c,
if (!buffer_params_match(calling_buf,
&ppl_data->params->params,
BUFF_PARAMS_FRAME_FMT |
BUFF_PARAMS_RATE)) {
Expand All @@ -66,8 +65,6 @@ static int pipeline_comp_params_neg(struct comp_dev *current,
err = -EINVAL;
}
}

buffer_release(buf_c);
return err;
}

Expand Down Expand Up @@ -188,11 +185,8 @@ static int pipeline_comp_hw_params_buf(struct comp_dev *current,
return ret;
/* set buffer parameters */
if (calling_buf) {
struct comp_buffer *buf_c = buffer_acquire(calling_buf);

ret = buffer_set_params(buf_c, &ppl_data->params->params,
ret = buffer_set_params(calling_buf, &ppl_data->params->params,
BUFFER_UPDATE_IF_UNSET);
buffer_release(buf_c);
if (ret < 0)
pipe_err(current->pipeline,
"pipeline_comp_hw_params(): buffer_set_params(): %d", ret);
Expand Down

0 comments on commit 2734113

Please sign in to comment.