@@ -289,7 +289,6 @@ static int mux_process(struct processing_module *mod,
289289 struct comp_data * cd = module_get_private_data (mod );
290290 struct comp_dev * dev = mod -> dev ;
291291 struct comp_buffer * source ;
292- struct list_item * clist ;
293292 const struct audio_stream * sources_stream [MUX_MAX_STREAMS ] = { NULL };
294293 int frames = 0 ;
295294 int sink_bytes ;
@@ -300,8 +299,7 @@ static int mux_process(struct processing_module *mod,
300299
301300 /* align source streams with their respective configurations */
302301 j = 0 ;
303- list_for_item (clist , & dev -> bsource_list ) {
304- source = container_of (clist , struct comp_buffer , sink_list );
302+ comp_dev_for_each_producer (dev , source ) {
305303 if (source -> source -> state == dev -> state ) {
306304 if (frames )
307305 frames = MIN (frames , input_buffers [j ].size );
@@ -332,8 +330,7 @@ static int mux_process(struct processing_module *mod,
332330
333331 /* Update consumed and produced */
334332 j = 0 ;
335- list_for_item (clist , & dev -> bsource_list ) {
336- source = container_of (clist , struct comp_buffer , sink_list );
333+ comp_dev_for_each_producer (dev , source ) {
337334 if (source -> source -> state == dev -> state )
338335 mod -> input_buffers [j ].consumed = source_bytes ;
339336 j ++ ;
@@ -344,17 +341,15 @@ static int mux_process(struct processing_module *mod,
344341
345342static int mux_reset (struct processing_module * mod )
346343{
347- struct list_item * blist ;
344+ struct comp_buffer * source ;
348345 struct comp_data * cd = module_get_private_data (mod );
349346 struct comp_dev * dev = mod -> dev ;
350347 int dir = dev -> pipeline -> source_comp -> direction ;
351348
352349 comp_dbg (dev , "mux_reset()" );
353350
354351 if (dir == SOF_IPC_STREAM_PLAYBACK ) {
355- list_for_item (blist , & dev -> bsource_list ) {
356- struct comp_buffer * source = container_of (blist , struct comp_buffer ,
357- sink_list );
352+ comp_dev_for_each_producer (dev , source ) {
358353 int state = source -> source -> state ;
359354
360355 /* only mux the sources with the same state with mux */
@@ -434,9 +429,6 @@ static int mux_set_config(struct processing_module *mod, uint32_t config_id,
434429
435430static int demux_trigger (struct processing_module * mod , int cmd )
436431{
437- struct list_item * li ;
438- struct comp_buffer * b ;
439-
440432 /* Check for cross-pipeline sinks: in general foreign
441433 * pipelines won't be started synchronously with ours (it's
442434 * under control of host software), so output can't be
@@ -446,8 +438,9 @@ static int demux_trigger(struct processing_module *mod, int cmd)
446438 * themselves.
447439 */
448440 if (cmd == COMP_TRIGGER_PRE_START ) {
449- list_for_item (li , & mod -> dev -> bsink_list ) {
450- b = container_of (li , struct comp_buffer , source_list );
441+ struct comp_buffer * b ;
442+
443+ comp_dev_for_each_producer (mod -> dev , b ) {
451444 if (b -> sink -> pipeline != mod -> dev -> pipeline )
452445 audio_stream_set_overrun (& b -> stream , true);
453446 }
0 commit comments