[alsa-devel] [PATCH 1/2] ASoC: wm8580: Fix build error

Sachin Kamat sachin.kamat at linaro.org
Fri Jan 24 09:39:24 CET 2014


Re-organize the code a bit to fix the following build errors and warnings:

sound/soc/codecs/wm8580.c:932:21: error: variable ‘wm8580_regmap’ has initializer but incomplete type
 static const struct regmap_config wm8580_regmap = {

sound/soc/codecs/wm8580.c:233:20: warning: ‘wm8580_supply_names’ defined but not used [-Wunused-variable]
sound/soc/codecs/wm8580.c:840:34: warning: ‘wm8580_dai’ defined but not used [-Wunused-variable]
sound/soc/codecs/wm8580.c:914:36: warning: ‘soc_codec_dev_wm8580’ defined but not used [-Wunused-variable]

Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
---
 sound/soc/codecs/wm8580.c |   38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 318989acbbe5..7a9d6fa9f3b3 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -214,28 +214,12 @@ static const struct reg_default wm8580_reg_defaults[] = {
 	{ 52, 0x0000 },
 };
 
-static bool wm8580_volatile(struct device *dev, unsigned int reg)
-{
-	switch (reg) {
-	case WM8580_RESET:
-		return true;
-	default:
-		return false;
-	}
-}
-
 struct pll_state {
 	unsigned int in;
 	unsigned int out;
 };
 
 #define WM8580_NUM_SUPPLIES 3
-static const char *wm8580_supply_names[WM8580_NUM_SUPPLIES] = {
-	"AVDD",
-	"DVDD",
-	"PVDD",
-};
-
 /* codec private data */
 struct wm8580_priv {
 	struct regmap *regmap;
@@ -837,6 +821,7 @@ static const struct snd_soc_dai_ops wm8580_dai_ops_capture = {
 	.set_pll	= wm8580_set_dai_pll,
 };
 
+#if IS_ENABLED(CONFIG_I2C)
 static struct snd_soc_dai_driver wm8580_dai[] = {
 	{
 		.name = "wm8580-hifi-playback",
@@ -863,6 +848,7 @@ static struct snd_soc_dai_driver wm8580_dai[] = {
 		.ops = &wm8580_dai_ops_capture,
 	},
 };
+#endif
 
 static int wm8580_probe(struct snd_soc_codec *codec)
 {
@@ -911,7 +897,7 @@ static int wm8580_remove(struct snd_soc_codec *codec)
 	return 0;
 }
 
-static struct snd_soc_codec_driver soc_codec_dev_wm8580 = {
+static struct snd_soc_codec_driver soc_codec_dev_wm8580 __maybe_unused = {
 	.probe =	wm8580_probe,
 	.remove =	wm8580_remove,
 	.set_bias_level = wm8580_set_bias_level,
@@ -929,6 +915,23 @@ static const struct of_device_id wm8580_of_match[] = {
 	{ },
 };
 
+#if IS_ENABLED(CONFIG_I2C)
+static const char *wm8580_supply_names[WM8580_NUM_SUPPLIES] = {
+	"AVDD",
+	"DVDD",
+	"PVDD",
+};
+
+static bool wm8580_volatile(struct device *dev, unsigned int reg)
+{
+	switch (reg) {
+	case WM8580_RESET:
+		return true;
+	default:
+		return false;
+	}
+}
+
 static const struct regmap_config wm8580_regmap = {
 	.reg_bits = 7,
 	.val_bits = 9,
@@ -941,7 +944,6 @@ static const struct regmap_config wm8580_regmap = {
 	.volatile_reg = wm8580_volatile,
 };
 
-#if IS_ENABLED(CONFIG_I2C)
 static int wm8580_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
-- 
1.7.9.5



More information about the Alsa-devel mailing list