mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org, linux-sound@vger.kernel.org
Cc: tiwai@suse.com, perex@perex.cz, amade@asmblr.net,
	linux-kernel@vger.kernel.org,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 03/11] ASoC: Intel: avs: Have one location for dumping path-errors
Date: Fri, 13 Nov 2026 12:38:32 +0100	[thread overview]
Message-ID: <20261113113840.3067489-4-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20261113113840.3067489-1-cezary.rojewski@intel.com>

Both path.c and pcm.c print the exact same error messages, one after the
other. Let the avs_path_xxx() handle the messaging so that its caller
need not to do themselves. At the same time enrich them with path's name
so there is no ambiguity which path is being manipulated.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/path.c | 31 +++++++++++++-----------
 sound/soc/intel/avs/pcm.c  | 48 ++++++--------------------------------
 2 files changed, 24 insertions(+), 55 deletions(-)

diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index 936be206eece..e8bbc9058fc7 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -11,6 +11,7 @@
 #include <acpi/nhlt.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
+#include <sound/soc-dapm.h>
 #include "avs.h"
 #include "control.h"
 #include "path.h"
@@ -1187,18 +1188,11 @@ static struct avs_path *avs_path_create_unlocked(struct avs_dev *adev, u32 dma_i
 
 static void avs_condpath_free(struct avs_dev *adev, struct avs_path *path)
 {
-	int ret;
-
 	list_del(&path->source_node);
 	list_del(&path->sink_node);
 
-	ret = avs_path_reset(path);
-	if (ret < 0)
-		dev_err(adev->dev, "reset condpath failed: %d\n", ret);
-
-	ret = avs_path_unbind(path);
-	if (ret < 0)
-		dev_err(adev->dev, "unbind condpath failed: %d\n", ret);
+	avs_path_reset(path);
+	avs_path_unbind(path);
 
 	avs_path_free_unlocked(path);
 }
@@ -1373,6 +1367,13 @@ static int avs_path_bind_prepare(struct avs_dev *adev,
 	return 0;
 }
 
+static const char *avs_path_name(struct avs_path *path)
+{
+	struct snd_soc_dapm_widget *w = path->template->owner->w;
+
+	return w ? w->name : "(condpath)";
+}
+
 int avs_path_bind(struct avs_path *path)
 {
 	struct avs_path_pipeline *ppl;
@@ -1397,7 +1398,8 @@ int avs_path_bind(struct avs_path *path)
 					   sink->instance_id, binding->sink_pin,
 					   binding->source_pin);
 			if (ret) {
-				dev_err(adev->dev, "bind path failed: %d\n", ret);
+				dev_err(adev->dev, "bind path %s failed: %d\n",
+					avs_path_name(path), ret);
 				return AVS_IPC_RET(ret);
 			}
 		}
@@ -1426,7 +1428,8 @@ int avs_path_unbind(struct avs_path *path)
 					     sink->instance_id, binding->sink_pin,
 					     binding->source_pin);
 			if (ret) {
-				dev_err(adev->dev, "unbind path failed: %d\n", ret);
+				dev_err(adev->dev, "unbind path %s failed: %d\n",
+					avs_path_name(path), ret);
 				return AVS_IPC_RET(ret);
 			}
 		}
@@ -1448,7 +1451,7 @@ int avs_path_reset(struct avs_path *path)
 		ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id,
 						 AVS_PPL_STATE_RESET);
 		if (ret) {
-			dev_err(adev->dev, "reset path failed: %d\n", ret);
+			dev_err(adev->dev, "reset path %s failed: %d\n", avs_path_name(path), ret);
 			path->state = AVS_PPL_STATE_INVALID;
 			return AVS_IPC_RET(ret);
 		}
@@ -1507,7 +1510,7 @@ int avs_path_pause(struct avs_path *path)
 		ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id,
 						 AVS_PPL_STATE_PAUSED);
 		if (ret) {
-			dev_err(adev->dev, "pause path failed: %d\n", ret);
+			dev_err(adev->dev, "pause path %s failed: %d\n", avs_path_name(path), ret);
 			path->state = AVS_PPL_STATE_INVALID;
 			return AVS_IPC_RET(ret);
 		}
@@ -1575,7 +1578,7 @@ int avs_path_run(struct avs_path *path, int trigger)
 		ret = avs_ipc_set_pipeline_state(adev, ppl->instance_id,
 						 AVS_PPL_STATE_RUNNING);
 		if (ret) {
-			dev_err(adev->dev, "run path failed: %d\n", ret);
+			dev_err(adev->dev, "run path %s failed: %d\n", avs_path_name(path), ret);
 			path->state = AVS_PPL_STATE_INVALID;
 			return AVS_IPC_RET(ret);
 		}
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index b0796d18c1c4..360cb8125bcc 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -227,15 +227,10 @@ static int avs_dai_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
 		return 0;
 
 	ret = avs_path_reset(data->path);
-	if (ret < 0) {
-		dev_err(dai->dev, "reset path failed: %d\n", ret);
+	if (ret < 0)
 		return ret;
-	}
 
-	ret = avs_path_pause(data->path);
-	if (ret < 0)
-		dev_err(dai->dev, "pause path failed: %d\n", ret);
-	return ret;
+	return avs_path_pause(data->path);
 }
 
 static int avs_dai_nonhda_be_hw_params(struct snd_pcm_substream *substream,
@@ -283,14 +278,10 @@ static int avs_dai_nonhda_be_trigger(struct snd_pcm_substream *substream, int cm
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		ret = avs_path_pause(data->path);
-		if (ret < 0) {
-			dev_err(dai->dev, "pause BE path failed: %d\n", ret);
+		if (ret < 0)
 			break;
-		}
 
 		ret = avs_path_run(data->path, AVS_TPLG_TRIGGER_AUTO);
-		if (ret < 0)
-			dev_err(dai->dev, "run BE path failed: %d\n", ret);
 		break;
 
 	case SNDRV_PCM_TRIGGER_SUSPEND:
@@ -300,12 +291,8 @@ static int avs_dai_nonhda_be_trigger(struct snd_pcm_substream *substream, int cm
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 	case SNDRV_PCM_TRIGGER_STOP:
 		ret = avs_path_pause(data->path);
-		if (ret < 0)
-			dev_err(dai->dev, "pause BE path failed: %d\n", ret);
 
 		ret2 = avs_path_reset(data->path);
-		if (ret2)
-			dev_err(dai->dev, "reset BE path failed: %d\n", ret2);
 		if (ret2 && !ret)
 			ret = ret2;
 		break;
@@ -510,14 +497,10 @@ static int avs_dai_hda_be_trigger(struct snd_pcm_substream *substream, int cmd,
 		snd_hdac_ext_stream_start(data->link_stream);
 
 		ret = avs_path_pause(data->path);
-		if (ret < 0) {
-			dev_err(dai->dev, "pause BE path failed: %d\n", ret);
+		if (ret < 0)
 			break;
-		}
 
 		ret = avs_path_run(data->path, AVS_TPLG_TRIGGER_AUTO);
-		if (ret < 0)
-			dev_err(dai->dev, "run BE path failed: %d\n", ret);
 		break;
 
 	case SNDRV_PCM_TRIGGER_SUSPEND:
@@ -527,14 +510,10 @@ static int avs_dai_hda_be_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 	case SNDRV_PCM_TRIGGER_STOP:
 		ret = avs_path_pause(data->path);
-		if (ret < 0)
-			dev_err(dai->dev, "pause BE path failed: %d\n", ret);
 
 		snd_hdac_ext_stream_clear(data->link_stream);
 
 		ret2 = avs_path_reset(data->path);
-		if (ret2)
-			dev_err(dai->dev, "reset BE path failed: %d\n", ret2);
 		if (ret2 && !ret)
 			ret = ret2;
 		break;
@@ -696,10 +675,8 @@ static int avs_dai_fe_hw_params(struct snd_pcm_substream *substream,
 		goto create_err;
 
 	ret = avs_path_bind(data->path);
-	if (ret < 0) {
-		dev_err(dai->dev, "bind FE <-> BE failed: %d\n", ret);
+	if (ret < 0)
 		goto bind_err;
-	}
 
 	return 0;
 
@@ -727,11 +704,9 @@ static int __avs_dai_fe_hw_free(struct snd_pcm_substream *substream, struct snd_
 	host_stream = data->host_stream;
 
 	ret = avs_path_unbind(data->path);
-	if (ret < 0)
-		dev_err(dai->dev, "unbind FE <-> BE failed: %d\n", ret);
-
 	avs_path_free(data->path);
 	data->path = NULL;
+
 	snd_hdac_stream_cleanup(hdac_stream(host_stream));
 	hdac_stream(host_stream)->prepared = false;
 
@@ -894,15 +869,10 @@ static int avs_dai_fe_trigger(struct snd_pcm_substream *substream, int cmd, stru
 			snd_hdac_stream_wait_drsm(hdac_stream(host_stream));
 
 		ret = avs_path_pause(data->path);
-		if (ret < 0) {
-			dev_err(dai->dev, "pause FE path failed: %d\n", ret);
+		if (ret < 0)
 			break;
-		}
 
 		ret = avs_path_run(data->path, AVS_TPLG_TRIGGER_AUTO);
-		if (ret < 0)
-			dev_err(dai->dev, "run FE path failed: %d\n", ret);
-
 		break;
 
 	case SNDRV_PCM_TRIGGER_SUSPEND:
@@ -912,16 +882,12 @@ static int avs_dai_fe_trigger(struct snd_pcm_substream *substream, int cmd, stru
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 	case SNDRV_PCM_TRIGGER_STOP:
 		ret = avs_path_pause(data->path);
-		if (ret < 0)
-			dev_err(dai->dev, "pause FE path failed: %d\n", ret);
 
 		spin_lock_irqsave(&bus->reg_lock, flags);
 		avs_hda_stream_stop(bus, host_stream);
 		spin_unlock_irqrestore(&bus->reg_lock, flags);
 
 		ret2 = avs_path_reset(data->path);
-		if (ret2)
-			dev_err(dai->dev, "reset FE path failed: %d\n", ret2);
 		if (ret2 && !ret)
 			ret = ret2;
 		break;
-- 
2.34.1


  parent reply	other threads:[~2026-11-13 11:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 11:38 [PATCH 00/11] ASoC: Intel: avs: Renames and debug prints Cezary Rojewski
2026-11-13 11:38 ` [PATCH 01/11] ASoC: Intel: avs: Do not skip error reporting when an IPC timeouts Cezary Rojewski
2026-11-13 11:38 ` [PATCH 02/11] ASoC: Intel: avs: Do not skip errors from avs_path_pause() Cezary Rojewski
2026-11-13 11:38 ` Cezary Rojewski [this message]
2026-11-13 11:38 ` [PATCH 04/11] ASoC: Intel: avs: Small registers cleanup Cezary Rojewski
2026-11-13 11:38 ` [PATCH 05/11] ASoC: Intel: avs: Enrich missing-format and token-parsing messages Cezary Rojewski
2026-11-13 11:38 ` [PATCH 06/11] ASoC: Intel: avs: Unify code style for platform_device_id arrays Cezary Rojewski
2026-11-13 11:38 ` [PATCH 07/11] ASoC: Intel: avs: Streamline topology parser names Cezary Rojewski
2026-11-13 11:38 ` [PATCH 08/11] ASoC: Intel: avs: Streamline wording used for board configs Cezary Rojewski
2026-11-13 11:38 ` [PATCH 09/11] ASoC: Intel: avs: Streamline naming of hw_params variables Cezary Rojewski
2026-11-13 11:38 ` [PATCH 10/11] ASoC: Intel: avs: Streamline spacing used in the avs_ids table Cezary Rojewski
2026-11-13 11:38 ` [PATCH 11/11] ASoC: Intel: avs: Remove soc-acpi-intel-match include Cezary Rojewski

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=20261113113840.3067489-4-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amade@asmblr.net \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®