From 5552e8be1d657976e19d78b6bf6292a290d3c835 Mon Sep 17 00:00:00 2001 From: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com> Date: Fri, 15 Sep 2023 20:09:33 +0200 Subject: [PATCH] tone: remove buffer_acquire from tone.c remove buffer ops from tone.c this is a continuation of changes from commit 4a03699 Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com> --- src/audio/tone.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/audio/tone.c b/src/audio/tone.c index 0f744cb75d4d..c669698bd13e 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -429,7 +429,6 @@ static int tone_params(struct comp_dev *dev, { struct comp_data *cd = comp_get_drvdata(dev); struct comp_buffer *sourceb, *sinkb; - struct comp_buffer *source_c, *sink_c; sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list); @@ -444,18 +443,12 @@ static int tone_params(struct comp_dev *dev, if (dev->ipc_config.frame_fmt != SOF_IPC_FRAME_S32_LE) return -EINVAL; - source_c = buffer_acquire(sourceb); - sink_c = buffer_acquire(sinkb); - - audio_stream_set_frm_fmt(&source_c->stream, dev->ipc_config.frame_fmt); - audio_stream_set_frm_fmt(&sink_c->stream, dev->ipc_config.frame_fmt); + audio_stream_set_frm_fmt(&sourceb->stream, dev->ipc_config.frame_fmt); + audio_stream_set_frm_fmt(&sinkb->stream, dev->ipc_config.frame_fmt); /* calculate period size based on config */ cd->period_bytes = dev->frames * - audio_stream_frame_bytes(&source_c->stream); - - buffer_release(sink_c); - buffer_release(source_c); + audio_stream_frame_bytes(&sourceb->stream); return 0; } @@ -634,7 +627,6 @@ static int tone_trigger(struct comp_dev *dev, int cmd) static int tone_copy(struct comp_dev *dev) { struct comp_buffer *sink; - struct comp_buffer *sink_c; struct comp_data *cd = comp_get_drvdata(dev); uint32_t free; int ret = 0; @@ -645,25 +637,22 @@ static int tone_copy(struct comp_dev *dev) sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list); - sink_c = buffer_acquire(sink); - free = audio_stream_get_free_bytes(&sink_c->stream); + free = audio_stream_get_free_bytes(&sink->stream); /* Test that sink has enough free frames. Then run once to maintain * low latency and steady load for tones. */ if (free >= cd->period_bytes) { /* create tone */ - cd->tone_func(dev, &sink_c->stream, dev->frames); - buffer_stream_writeback(sink_c, cd->period_bytes); + cd->tone_func(dev, &sink->stream, dev->frames); + buffer_stream_writeback(sink, cd->period_bytes); /* calc new free and available */ - comp_update_buffer_produce(sink_c, cd->period_bytes); + comp_update_buffer_produce(sink, cd->period_bytes); ret = dev->frames; } - buffer_release(sink_c); - return ret; }