Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com,
	pierre-louis.bossart@linux.intel.com, rander.wang@intel.com,
	ranjani.sridharan@linux.intel.com,
	yung-chuan.liao@linux.intel.com
Subject: [PATCH 13/18] ASoC: SOF: ipc4-pcm: Rename 'data' variable to trigger_list
Date: Fri, 27 Jan 2023 14:00:26 +0200	[thread overview]
Message-ID: <20230127120031.10709-14-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20230127120031.10709-1-peter.ujfalusi@linux.intel.com>

From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

For more clarity, rename the struct ipc4_pipeline_set_state_data
variable to trigger_list instead of data. No functionality change.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
 sound/soc/sof/ipc4-pcm.c | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/sound/soc/sof/ipc4-pcm.c b/sound/soc/sof/ipc4-pcm.c
index 17a116e8c47c..284e402709be 100644
--- a/sound/soc/sof/ipc4-pcm.c
+++ b/sound/soc/sof/ipc4-pcm.c
@@ -14,14 +14,14 @@
 #include "ipc4-topology.h"
 
 static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state,
-					     struct ipc4_pipeline_set_state_data *data)
+					     struct ipc4_pipeline_set_state_data *trigger_list)
 {
 	struct sof_ipc4_msg msg = {{ 0 }};
 	u32 primary, ipc_size;
 
 	/* trigger a single pipeline */
-	if (data->count == 1)
-		return sof_ipc4_set_pipeline_state(sdev, data->pipeline_ids[0], state);
+	if (trigger_list->count == 1)
+		return sof_ipc4_set_pipeline_state(sdev, trigger_list->pipeline_ids[0], state);
 
 	primary = state;
 	primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_SET_PIPELINE_STATE);
@@ -33,9 +33,9 @@ static int sof_ipc4_set_multi_pipeline_state(struct snd_sof_dev *sdev, u32 state
 	msg.extension = SOF_IPC4_GLB_PIPE_STATE_EXT_MULTI;
 
 	/* ipc_size includes the count and the pipeline IDs for the number of pipelines */
-	ipc_size = sizeof(u32) * (data->count + 1);
+	ipc_size = sizeof(u32) * (trigger_list->count + 1);
 	msg.data_size = ipc_size;
-	msg.data_ptr = data;
+	msg.data_ptr = trigger_list;
 
 	return sof_ipc_tx_message(sdev->ipc, &msg, ipc_size, NULL, 0);
 }
@@ -65,7 +65,7 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
 	struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_sof_pcm_stream_pipeline_list *pipeline_list;
-	struct ipc4_pipeline_set_state_data *data;
+	struct ipc4_pipeline_set_state_data *trigger_list;
 	struct snd_sof_widget *pipe_widget;
 	struct sof_ipc4_pipeline *pipeline;
 	struct snd_sof_pipeline *spipe;
@@ -84,8 +84,9 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
 		return 0;
 
 	/* allocate memory for the pipeline data */
-	data = kzalloc(struct_size(data, pipeline_ids, pipeline_list->count), GFP_KERNEL);
-	if (!data)
+	trigger_list = kzalloc(struct_size(trigger_list, pipeline_ids, pipeline_list->count),
+			       GFP_KERNEL);
+	if (!trigger_list)
 		return -ENOMEM;
 
 	/*
@@ -101,12 +102,13 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
 		pipe_widget = spipe->pipe_widget;
 		pipeline = pipe_widget->private;
 		if (pipeline->state != state && !pipeline->skip_during_fe_trigger)
-			data->pipeline_ids[data->count++] = pipe_widget->instance_id;
+			trigger_list->pipeline_ids[trigger_list->count++] =
+				pipe_widget->instance_id;
 	}
 
 	/* return if all pipelines are in the requested state already */
-	if (!data->count) {
-		kfree(data);
+	if (!trigger_list->count) {
+		kfree(trigger_list);
 		return 0;
 	}
 
@@ -115,20 +117,20 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
 	 * they are already paused. But it helps keep the logic simpler and the firmware handles
 	 * the repeated pause gracefully. This can be optimized in the future if needed.
 	 */
-	ret = sof_ipc4_set_multi_pipeline_state(sdev, SOF_IPC4_PIPE_PAUSED, data);
+	ret = sof_ipc4_set_multi_pipeline_state(sdev, SOF_IPC4_PIPE_PAUSED, trigger_list);
 	if (ret < 0) {
 		dev_err(sdev->dev, "failed to pause all pipelines\n");
 		goto free;
 	}
 
 	/* update PAUSED state for all pipelines that were just triggered */
-	for (i = 0; i < data->count; i++) {
+	for (i = 0; i < trigger_list->count; i++) {
 		for (j = 0; j < pipeline_list->count; j++) {
 			spipe = pipeline_list->pipelines[j];
 			pipe_widget = spipe->pipe_widget;
 			pipeline = pipe_widget->private;
 
-			if (data->pipeline_ids[i] == pipe_widget->instance_id) {
+			if (trigger_list->pipeline_ids[i] == pipe_widget->instance_id) {
 				pipeline->state = SOF_IPC4_PIPE_PAUSED;
 				break;
 			}
@@ -140,20 +142,20 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
 		goto free;
 
 	/* else set the final state in the DSP */
-	ret = sof_ipc4_set_multi_pipeline_state(sdev, state, data);
+	ret = sof_ipc4_set_multi_pipeline_state(sdev, state, trigger_list);
 	if (ret < 0) {
 		dev_err(sdev->dev, "failed to set final state %d for all pipelines\n", state);
 		goto free;
 	}
 
 	/* update final state for all pipelines that were just triggered */
-	for (i = 0; i < data->count; i++) {
+	for (i = 0; i < trigger_list->count; i++) {
 		for (j = 0; j < pipeline_list->count; j++) {
 			spipe = pipeline_list->pipelines[j];
 			pipe_widget = spipe->pipe_widget;
 			pipeline = pipe_widget->private;
 
-			if (data->pipeline_ids[i] == pipe_widget->instance_id) {
+			if (trigger_list->pipeline_ids[i] == pipe_widget->instance_id) {
 				pipeline->state = state;
 				break;
 			}
@@ -161,7 +163,7 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
 	}
 
 free:
-	kfree(data);
+	kfree(trigger_list);
 	return ret;
 }
 
-- 
2.39.1


  parent reply	other threads:[~2023-01-27 12:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 12:00 From 644473b181f0f310e428301a2ed459f912eec7ea Mon Sep 17 00:00:00 2001 Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 01/18] ASoC: SOF: ipc4-topology: No need to unbind routes within a pipeline Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 02/18] ASoC: soc-pcm: Export widget_in_list() Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 03/18] ASoC: SOF: sof-audio: Set up/free DAI/AIF widgets only once Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 04/18] ASoC: SOF: sof-audio: Only process widgets in the connected widget list Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 05/18] ASoC: SOF: pcm: do not free widgets during suspend trigger Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 06/18] ASoC: SOF: topology: Set IPC-specific trigger order for DAI links Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 07/18] ASoC: SOF: Introduce PCM setup/free PCM IPC ops Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 08/18] ASoC: SOF: ipc4-pcm: Define pcm_setup/free ops Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 09/18] ASoC: SOF: ipc4: Add flag to skip triggering pipelines during FE DAI trigger Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 10/18] ASoC: SOF: sof-audio: Populate the PCM stream pipeline_info Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 11/18] ASoC: SOF: ipc4-pcm: Use the PCM stream's pipeline_info during trigger Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 12/18] ASoC: SOF: Introduce struct snd_sof_pipeline Peter Ujfalusi
2023-01-27 12:00 ` Peter Ujfalusi [this message]
2023-01-27 12:00 ` [PATCH 14/18] ASoC: SOF: ipc4-pcm: Implement pipeline trigger reference counting Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 15/18] ASoC: SOF: ipc4-topology: Protect pipeline free with mutex Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 16/18] ASoC: SOF: Avoid double decrementing use_count in sof_widget_setup on error Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 17/18] ASoC: SOF: Protect swidget->use_count with mutex for kcontrol access race Peter Ujfalusi
2023-01-27 12:00 ` [PATCH 18/18] ASoC: SOF: ipc4-pcm: Do not run the trigger pipelines if no spipe is stored Peter Ujfalusi
2023-01-27 12:07 ` [PATCH 00/18] ASoC: SOF: ipc4: Multi-stream playback and capture support Péter Ujfalusi
2023-01-28 10:48 ` From 644473b181f0f310e428301a2ed459f912eec7ea Mon Sep 17 00:00:00 2001 Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230127120031.10709-14-peter.ujfalusi@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rander.wang@intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox