From 6ebd83ad7b2bff00ad3e25811c38e73bb4201b07 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 9 Feb 2017 14:40:33 +0000
Subject: [PATCH] sound: Suppress error message about deferrals

Since driver load deferrals are expected and will already
have resulted in a kernel message, suppress an essentially
duplicate error message from the RPi audio board drivers.

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
 sound/soc/bcm/adau1977-adc.c       | 2 +-
 sound/soc/bcm/allo-piano-dac.c     | 2 +-
 sound/soc/bcm/digidac1-soundcard.c | 4 ++--
 sound/soc/bcm/dionaudio_loco.c     | 2 +-
 sound/soc/bcm/hifiberry_amp.c      | 3 +--
 sound/soc/bcm/hifiberry_dac.c      | 2 +-
 sound/soc/bcm/hifiberry_dacplus.c  | 2 +-
 sound/soc/bcm/hifiberry_digi.c     | 2 +-
 sound/soc/bcm/iqaudio-dac.c        | 5 +++--
 sound/soc/bcm/iqaudio_digi.c       | 2 +-
 sound/soc/bcm/justboom-dac.c       | 2 +-
 sound/soc/bcm/justboom-digi.c      | 2 +-
 sound/soc/bcm/pisound.c            | 3 ++-
 sound/soc/bcm/raspidac3.c          | 2 +-
 sound/soc/bcm/rpi-dac.c            | 2 +-
 sound/soc/bcm/rpi-proto.c          | 3 +--
 16 files changed, 20 insertions(+), 20 deletions(-)

--- a/sound/soc/bcm/adau1977-adc.c
+++ b/sound/soc/bcm/adau1977-adc.c
@@ -90,7 +90,7 @@ static int snd_adau1977_adc_probe(struct
 	}
 
 	ret = snd_soc_register_card(&snd_adau1977_adc);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
 
 	return ret;
--- a/sound/soc/bcm/allo-piano-dac.c
+++ b/sound/soc/bcm/allo-piano-dac.c
@@ -109,7 +109,7 @@ static int snd_allo_piano_dac_probe(stru
 	}
 
 	ret = snd_soc_register_card(&snd_allo_piano_dac);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev,
 			"snd_soc_register_card() failed: %d\n", ret);
 
--- a/sound/soc/bcm/digidac1-soundcard.c
+++ b/sound/soc/bcm/digidac1-soundcard.c
@@ -387,9 +387,9 @@ static int digidac1_soundcard_probe(stru
 	}
 
 	ret = snd_soc_register_card(&digidac1_soundcard);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
-		 ret);
+			ret);
 
 	return ret;
 }
--- a/sound/soc/bcm/dionaudio_loco.c
+++ b/sound/soc/bcm/dionaudio_loco.c
@@ -86,7 +86,7 @@ static int snd_rpi_dionaudio_loco_probe(
 	}
 
 	ret = snd_soc_register_card(&snd_rpi_dionaudio_loco);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
 			ret);
 
--- a/sound/soc/bcm/hifiberry_amp.c
+++ b/sound/soc/bcm/hifiberry_amp.c
@@ -96,9 +96,8 @@ static int snd_rpi_hifiberry_amp_probe(s
 
 	ret = snd_soc_register_card(&snd_rpi_hifiberry_amp);
 
-	if (ret != 0) {
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
-	}
 
 	return ret;
 }
--- a/sound/soc/bcm/hifiberry_dac.c
+++ b/sound/soc/bcm/hifiberry_dac.c
@@ -90,7 +90,7 @@ static int snd_rpi_hifiberry_dac_probe(s
 	}
 
 	ret = snd_soc_register_card(&snd_rpi_hifiberry_dac);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
 
 	return ret;
--- a/sound/soc/bcm/hifiberry_dacplus.c
+++ b/sound/soc/bcm/hifiberry_dacplus.c
@@ -324,7 +324,7 @@ static int snd_rpi_hifiberry_dacplus_pro
 	}
 
 	ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev,
 			"snd_soc_register_card() failed: %d\n", ret);
 
--- a/sound/soc/bcm/hifiberry_digi.c
+++ b/sound/soc/bcm/hifiberry_digi.c
@@ -242,7 +242,7 @@ static int snd_rpi_hifiberry_digi_probe(
 	}
 
 	ret = snd_soc_register_card(&snd_rpi_hifiberry_digi);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
 
 	return ret;
--- a/sound/soc/bcm/iqaudio-dac.c
+++ b/sound/soc/bcm/iqaudio-dac.c
@@ -197,8 +197,9 @@ static int snd_rpi_iqaudio_dac_probe(str
 
 	ret = snd_soc_register_card(&snd_rpi_iqaudio_dac);
 	if (ret) {
-		dev_err(&pdev->dev,
-			"snd_soc_register_card() failed: %d\n", ret);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev,
+				"snd_soc_register_card() failed: %d\n", ret);
 		return ret;
 	}
 
--- a/sound/soc/bcm/iqaudio_digi.c
+++ b/sound/soc/bcm/iqaudio_digi.c
@@ -204,7 +204,7 @@ static int snd_rpi_iqaudio_digi_probe(st
 	}
 
 	ret = snd_soc_register_card(card);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
 			ret);
 
--- a/sound/soc/bcm/justboom-dac.c
+++ b/sound/soc/bcm/justboom-dac.c
@@ -128,7 +128,7 @@ static int snd_rpi_justboom_dac_probe(st
 	}
 
 	ret = snd_soc_register_card(&snd_rpi_justboom_dac);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev,
 			"snd_soc_register_card() failed: %d\n", ret);
 
--- a/sound/soc/bcm/justboom-digi.c
+++ b/sound/soc/bcm/justboom-digi.c
@@ -181,7 +181,7 @@ static int snd_rpi_justboom_digi_probe(s
 	}
 
 	ret = snd_soc_register_card(&snd_rpi_justboom_digi);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev,
 			"snd_soc_register_card() failed: %d\n", ret);
 
--- a/sound/soc/bcm/pisound.c
+++ b/sound/soc/bcm/pisound.c
@@ -1076,7 +1076,8 @@ static int pisnd_probe(struct platform_d
 	ret = snd_soc_register_card(&pisnd_card);
 
 	if (ret < 0) {
-		printe("snd_soc_register_card() failed: %d\n", ret);
+		if (ret != -EPROBE_DEFER)
+			printe("snd_soc_register_card() failed: %d\n", ret);
 		pisnd_uninit_gpio();
 		kobject_put(pisnd_kobj);
 		pisnd_spi_uninit();
--- a/sound/soc/bcm/raspidac3.c
+++ b/sound/soc/bcm/raspidac3.c
@@ -149,7 +149,7 @@ static int snd_rpi_raspidac3_probe(struc
 	}
 
 	ret = snd_soc_register_card(&snd_rpi_raspidac3);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev,
 			"snd_soc_register_card() failed: %d\n", ret);
 
--- a/sound/soc/bcm/rpi-dac.c
+++ b/sound/soc/bcm/rpi-dac.c
@@ -85,7 +85,7 @@ static int snd_rpi_rpi_dac_probe(struct
 	}
 	
 	ret = snd_soc_register_card(&snd_rpi_rpi_dac);
-	if (ret)
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
 
 	return ret;
--- a/sound/soc/bcm/rpi-proto.c
+++ b/sound/soc/bcm/rpi-proto.c
@@ -117,10 +117,9 @@ static int snd_rpi_proto_probe(struct pl
 	}
 
 	ret = snd_soc_register_card(&snd_rpi_proto);
-	if (ret) {
+	if (ret && ret != -EPROBE_DEFER)
 		dev_err(&pdev->dev,
 				"snd_soc_register_card() failed: %d\n", ret);
-	}
 
 	return ret;
 }
