@@ -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,14 @@ static int mux_process(struct processing_module *mod,
344341
345342static int mux_reset (struct processing_module * mod )
346343{
347- struct list_item * blist ;
348344 struct comp_data * cd = module_get_private_data (mod );
349345 struct comp_dev * dev = mod -> dev ;
350346 int dir = dev -> pipeline -> source_comp -> direction ;
351347
352348 comp_dbg (dev , "mux_reset()" );
353349
354350 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 );
351+ comp_dev_for_each_producer (dev , source ) {
358352 int state = source -> source -> state ;
359353
360354 /* only mux the sources with the same state with mux */
@@ -434,9 +428,6 @@ static int mux_set_config(struct processing_module *mod, uint32_t config_id,
434428
435429static int demux_trigger (struct processing_module * mod , int cmd )
436430{
437- struct list_item * li ;
438- struct comp_buffer * b ;
439-
440431 /* Check for cross-pipeline sinks: in general foreign
441432 * pipelines won't be started synchronously with ours (it's
442433 * under control of host software), so output can't be
@@ -446,8 +437,9 @@ static int demux_trigger(struct processing_module *mod, int cmd)
446437 * themselves.
447438 */
448439 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 );
440+ struct comp_buffer * b ;
441+
442+ comp_dev_for_each_producer (mod -> dev , b ) {
451443 if (b -> sink -> pipeline != mod -> dev -> pipeline )
452444 audio_stream_set_overrun (& b -> stream , true);
453445 }
0 commit comments