pipeline: add a flag to indicate if the buffer is being traversed

Add a flag 'walking' to the buffer struct, to indicate if the buffer is
just being traversed while walking through the graph, and don't go back
to the buffer which is already walked.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This commit is contained in:
Keyon Jie 2020-05-30 01:25:00 +08:00 committed by Liam Girdwood
parent 2ae18268a8
commit 968eaf1621
2 changed files with 7 additions and 0 deletions

View File

@ -169,6 +169,10 @@ static int pipeline_for_each_comp(struct comp_dev *current,
list_for_item(clist, buffer_list) {
buffer = buffer_from_list(clist, struct comp_buffer, dir);
/* don't go back to the buffer which already walked */
if (buffer->walking)
continue;
/* execute operation on buffer */
if (ctx->buff_func)
ctx->buff_func(buffer, ctx->buff_data);
@ -182,8 +186,10 @@ static int pipeline_for_each_comp(struct comp_dev *current,
/* continue further */
if (ctx->comp_func) {
buffer->walking = true;
int err = ctx->comp_func(buffer_comp, buffer,
ctx, dir);
buffer->walking = false;
if (err < 0)
return err;
}

View File

@ -111,6 +111,7 @@ struct comp_buffer {
uint16_t chmap[SOF_IPC_MAX_CHANNELS]; /**< channel map - SOF_CHMAP_ */
bool hw_params_configured; /**< indicates whether hw params were set */
bool walking; /**< indicates if the buffer is being walking */
};
struct buffer_cb_transact {