diff mbox

[1/2] ASoC: wm8580: Fix build error

Message ID 1390552765-32210-1-git-send-email-sachin.kamat@linaro.org
State Changes Requested
Headers show

Commit Message

Sachin Kamat Jan. 24, 2014, 8:39 a.m. UTC
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@linaro.org>
---
 sound/soc/codecs/wm8580.c |   38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

Comments

Sachin Kamat Jan. 24, 2014, 11:52 a.m. UTC | #1
On 24 January 2014 16:40, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Jan 24, 2014 at 02:09:24PM +0530, Sachin Kamat wrote:
>
>> +#if IS_ENABLED(CONFIG_I2C)
>> +static const char *wm8580_supply_names[WM8580_NUM_SUPPLIES] = {
>> +     "AVDD",
>> +     "DVDD",
>> +     "PVDD",
>> +};
>
> This is obviously not sensible - the device doesn't suddenly stop
> needing power if it is using SPI.

This structure is being used only in wm8580_i2c_probe which is guarded
by IS_ENABLED(CONFIG_I2C).
Do you mean the existing implementation is wrong or we just need to
move it out of the #if?
diff mbox

Patch

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)
 {