probe: simplify ipc4_get_buffer()

Use a local variable in ipc4_get_buffer() to simplify it and remove
redundant code.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2022-12-20 08:13:36 +01:00 committed by Kai Vehmanen
parent 40e6c1ddc0
commit b516172a41
1 changed files with 11 additions and 19 deletions

View File

@ -979,41 +979,33 @@ static struct comp_buffer *ipc4_get_buffer(struct ipc_comp_dev *dev, probe_point
struct comp_buffer *buf;
struct comp_buffer __sparse_cache *buf_c;
struct list_item *sink_list, *source_list;
unsigned int queue_id;
switch (probe_point.fields.type) {
case PROBE_TYPE_INPUT:
if (list_is_empty(&dev->cd->bsource_list))
return NULL;
list_for_item(source_list, &dev->cd->bsource_list) {
buf = container_of(source_list, struct comp_buffer, sink_list);
buf_c = buffer_acquire(buf);
if (IPC4_SRC_QUEUE_ID(buf_c->id) == probe_point.fields.index)
break;
queue_id = IPC4_SRC_QUEUE_ID(buf_c->id);
buffer_release(buf_c);
if (queue_id == probe_point.fields.index)
return buf;
}
break;
case PROBE_TYPE_OUTPUT:
if (list_is_empty(&dev->cd->bsink_list))
return NULL;
list_for_item(sink_list, &dev->cd->bsink_list) {
buf = container_of(sink_list, struct comp_buffer, source_list);
buf_c = buffer_acquire(buf);
if (IPC4_SINK_QUEUE_ID(buf_c->id) == probe_point.fields.index)
break;
queue_id = IPC4_SINK_QUEUE_ID(buf_c->id);
buffer_release(buf_c);
if (queue_id == probe_point.fields.index)
return buf;
}
break;
default:
return NULL;
}
buffer_release(buf_c);
return buf;
return NULL;
}
#endif