Skip to contentSkip to conversation

ASoC: reduce verbosity of error messages for sof-dai and sof-link

PATCH Superseded Pierre-Louis Bossart 2 participants 3 messages May 29, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: reduce verbosity of error messages for sof-dai and sof-link

Recent changes result in multiple dmesg traces such as:

[ 14.410435] Audio Port: ASoC: error at snd_soc_link_startup on Audio

Port: 1

[ 14.410446] sst-mfld-platform sst-mfld-platform: ASoC: error at

snd_soc_dai_startup on media-cpu-dai: 1

These messages are not really errors, when dai and dai-link callbacks return the value of e.g. snd_pcm_hw_constraint_single() the result is "Positive if the value is changed, zero if it's not changed, or a negative error code"

Add a simple test to only log errors when the result is negative.

---
 sound/soc/soc-dai.c  | 7 ++++---
 sound/soc/soc-link.c | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
sound/soc/soc-dai.c +4 -3
index 2c6ac3b0afa5..6a0e7560bacc 100644
@@ -20,9 +20,10 @@ static inline int _soc_dai_ret(struct snd_soc_dai *dai,
 	case 0:
 		break;
 	default:
-		dev_err(dai->dev,
-			"ASoC: error at %s on %s: %d\n",
-			func, dai->name, ret);
+		if (ret < 0)
+			dev_err(dai->dev,
+				"ASoC: error at %s on %s: %d\n",
+				func, dai->name, ret);
 	}
 
 	return ret;
sound/soc/soc-link.c +4 -3
index 248e1be4e1eb..ff053d4c1a49 100644
@@ -18,9 +18,10 @@ static inline int _soc_link_ret(struct snd_soc_pcm_runtime *rtd,
 	case 0:
 		break;
 	default:
-		dev_err(rtd->dev,
-			"ASoC: error at %s on %s: %d\n",
-			func, rtd->dai_link->name, ret);
+		if (ret < 0)
+			dev_err(rtd->dev,
+				"ASoC: error at %s on %s: %d\n",
+				func, rtd->dai_link->name, ret);
 	}
 
 	return ret;

base-commit: 4a0434502191347ba8f99468f2fb2cdddc20d381

Signature · 1 line
2.20.1
#1 lore raw

Hi Pierre-Louis

Quoted 13 lines

Recent changes result in multiple dmesg traces such as:

[ 14.410435] Audio Port: ASoC: error at snd_soc_link_startup on Audio

Port: 1

[ 14.410446] sst-mfld-platform sst-mfld-platform: ASoC: error at

snd_soc_dai_startup on media-cpu-dai: 1

These messages are not really errors, when dai and dai-link callbacks return the value of e.g. snd_pcm_hw_constraint_single() the result is "Positive if the value is changed, zero if it's not changed, or a negative error code"

Quoted 5 lines

Add a simple test to only log errors when the result is negative.

---

Thank you for pointing it.
Some functions which has above rule isn't use soc_xxx_ret() actually. Anyway, more simply, how about this ?

----------

sound/soc/soc-dai.c +5 -1
index ae8b2c93cb66..da83059faf4e 100644
@@ -14,10 +14,14 @@
 static inline int _soc_dai_ret(struct snd_soc_dai *dai,
 			       const char *func, int ret)
 {
+	/* Positive, Zero are not error */
+	if (ret >= 0)
+		return ret;
+
+	/* Negative might be error */
 	switch (ret) {
 	case -EPROBE_DEFER:
 	case -ENOTSUPP:
-	case 0:
 		break;
 	default:
 		dev_err(dai->dev,

----------

Thank you for your help !!

Best regards
---
Kuninori Morimoto

#2 lore raw
Quoted 19 lines · Kuninori Morimoto

Hi Pierre-Louis

Quoted 16 lines

Recent changes result in multiple dmesg traces such as:

[ 14.410435] Audio Port: ASoC: error at snd_soc_link_startup on Audio

Port: 1

[ 14.410446] sst-mfld-platform sst-mfld-platform: ASoC: error at

snd_soc_dai_startup on media-cpu-dai: 1

These messages are not really errors, when dai and dai-link callbacks return the value of e.g. snd_pcm_hw_constraint_single() the result is "Positive if the value is changed, zero if it's not changed, or a negative error code"

Add a simple test to only log errors when the result is negative.

Quoted 6 lines
Quoted 2 lines

---

Thank you for pointing it.
Some functions which has above rule isn't use soc_xxx_ret() actually. Anyway, more simply, how about this ?

Sounds good, will send a v2 with your suggestion.

Quoted 30 lines

----------

sound/soc/soc-dai.c +5 -2
index ae8b2c93cb66..da83059faf4e 100644
@@ -14,10 +14,14 @@
  static inline int _soc_dai_ret(struct snd_soc_dai *dai,
  			       const char *func, int ret)
  {
+	/* Positive, Zero are not error */
+	if (ret >= 0)
+		return ret;
+
+	/* Negative might be error */
  	switch (ret) {
  	case -EPROBE_DEFER:
  	case -ENOTSUPP:
-	case 0:
  		break;
  	default:
  		dev_err(dai->dev,
----------

Thank you for your help !!

Best regards
---
Kuninori Morimoto