[PATCH v2] ASoC: wm8731: Fix a unused function gcc warning

From: zhong jiang
Date: Sat Sep 29 2018 - 22:49:04 EST


Fix the following compile warning:

sound/soc/codecs/wm8731.c:575:12: warning: 'wm8731_request_supplies' defined but not used [-Wunused-function]
sound/soc/codecs/wm8731.c:600:12: warning: 'wm8731_hw_init' defined but not used [-Wunused-function]

Signed-off-by: zhong jiang <zhongjiang@xxxxxxxxxx>
---
v1->v2:
- Move the declaration of wm8731_supply_names into the #if block
unused function has been wrapped to decrease the #if block definition.

sound/soc/codecs/wm8731.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 7c8fad8..9399103 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -36,12 +36,6 @@
#include "wm8731.h"

#define WM8731_NUM_SUPPLIES 4
-static const char *wm8731_supply_names[WM8731_NUM_SUPPLIES] = {
- "AVDD",
- "HPVDD",
- "DCVDD",
- "DBVDD",
-};

/* codec private data */
struct wm8731_priv {
@@ -572,6 +566,14 @@ static int wm8731_startup(struct snd_pcm_substream *substream,
.symmetric_rates = 1,
};

+#if defined(CONFIG_I2C) || defined(CONFIG_SPI_MASTER)
+static const char *wm8731_supply_names[WM8731_NUM_SUPPLIES] = {
+ "AVDD",
+ "HPVDD",
+ "DCVDD",
+ "DBVDD",
+};
+
static int wm8731_request_supplies(struct device *dev,
struct wm8731_priv *wm8731)
{
@@ -627,6 +629,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)

return ret;
}
+#endif

static const struct snd_soc_component_driver soc_component_dev_wm8731 = {
.set_bias_level = wm8731_set_bias_level,
--
1.7.12.4