2018-09-30 02:47:09

by zhong jiang

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

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 <[email protected]>
---
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



2018-09-30 05:34:11

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2] ASoC: wm8731: Fix a unused function gcc warning

Hi zhong,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on v4.19-rc5 next-20180928]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/zhong-jiang/ASoC-wm8731-Fix-a-unused-function-gcc-warning/20180930-104811
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: x86_64-randconfig-j3-09262047 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

sound/soc/codecs/wm8731.c: In function 'wm8731_i2c_probe':
sound/soc/codecs/wm8731.c:765:2: error: implicit declaration of function 'wm8731_request_supplies' [-Werror=implicit-function-declaration]
ret = wm8731_request_supplies(&i2c->dev, wm8731);
^
>> sound/soc/codecs/wm8731.c:777:2: error: implicit declaration of function 'wm8731_hw_init' [-Werror=implicit-function-declaration]
ret = wm8731_hw_init(&i2c->dev, wm8731);
^
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:__ffs
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc
Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata
Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
Cyclomatic Complexity 1 include/linux/i2c.h:i2c_set_clientdata
Cyclomatic Complexity 3 include/linux/clk.h:clk_prepare_enable
Cyclomatic Complexity 1 include/linux/clk.h:clk_disable_unprepare
Cyclomatic Complexity 1 include/sound/pcm.h:hw_param_mask_c
Cyclomatic Complexity 1 include/sound/pcm.h:hw_param_interval_c
Cyclomatic Complexity 1 include/sound/pcm.h:params_rate
Cyclomatic Complexity 3 include/sound/pcm_params.h:snd_mask_min
Cyclomatic Complexity 1 include/sound/pcm_params.h:params_format
Cyclomatic Complexity 1 include/sound/pcm_params.h:params_width
Cyclomatic Complexity 1 include/sound/soc-dapm.h:snd_soc_dapm_get_bias_level
Cyclomatic Complexity 2 include/sound/soc.h:snd_soc_dapm_to_component
Cyclomatic Complexity 1 include/sound/soc.h:snd_soc_component_get_dapm
Cyclomatic Complexity 1 include/sound/soc.h:snd_soc_component_get_bias_level
Cyclomatic Complexity 1 include/sound/soc.h:snd_soc_component_get_drvdata
Cyclomatic Complexity 1 include/sound/soc.h:snd_soc_kcontrol_component
Cyclomatic Complexity 1 sound/soc/codecs/wm8731.c:wm8731_volatile
Cyclomatic Complexity 1 sound/soc/codecs/wm8731.c:wm8731_get_deemph
Cyclomatic Complexity 1 sound/soc/codecs/wm8731.c:wm8731_check_osc
Cyclomatic Complexity 4 sound/soc/codecs/wm8731.c:get_coeff
Cyclomatic Complexity 1 sound/soc/codecs/wm8731.c:wm8731_i2c_remove
Cyclomatic Complexity 8 sound/soc/codecs/wm8731.c:wm8731_i2c_probe
Cyclomatic Complexity 12 sound/soc/codecs/wm8731.c:wm8731_set_dai_fmt
Cyclomatic Complexity 2 sound/soc/codecs/wm8731.c:wm8731_mute
Cyclomatic Complexity 4 sound/soc/codecs/wm8731.c:wm8731_set_deemph
Cyclomatic Complexity 4 sound/soc/codecs/wm8731.c:wm8731_hw_params
Cyclomatic Complexity 8 sound/soc/codecs/wm8731.c:wm8731_set_dai_sysclk
Cyclomatic Complexity 2 sound/soc/codecs/wm8731.c:wm8731_startup
Cyclomatic Complexity 9 sound/soc/codecs/wm8731.c:wm8731_set_bias_level
Cyclomatic Complexity 3 sound/soc/codecs/wm8731.c:wm8731_put_deemph
Cyclomatic Complexity 2 sound/soc/codecs/wm8731.c:wm8731_modinit
Cyclomatic Complexity 1 sound/soc/codecs/wm8731.c:wm8731_exit
cc1: some warnings being treated as errors

vim +/wm8731_hw_init +777 sound/soc/codecs/wm8731.c

a8035c8f0 Mark Brown 2009-02-16 735
b65ab73e5 Fabio Estevam 2013-11-21 736 #if IS_ENABLED(CONFIG_I2C)
7a79e94e9 Bill Pemberton 2012-12-07 737 static int wm8731_i2c_probe(struct i2c_client *i2c,
a8035c8f0 Mark Brown 2009-02-16 738 const struct i2c_device_id *id)
a8035c8f0 Mark Brown 2009-02-16 739 {
5998102b9 Mark Brown 2009-02-16 740 struct wm8731_priv *wm8731;
f0fba2ad1 Liam Girdwood 2010-03-17 741 int ret;
5998102b9 Mark Brown 2009-02-16 742
f1992dde7 Mark Brown 2012-05-12 743 wm8731 = devm_kzalloc(&i2c->dev, sizeof(struct wm8731_priv),
f1992dde7 Mark Brown 2012-05-12 744 GFP_KERNEL);
5998102b9 Mark Brown 2009-02-16 745 if (wm8731 == NULL)
5998102b9 Mark Brown 2009-02-16 746 return -ENOMEM;
a8035c8f0 Mark Brown 2009-02-16 747
99d422341 Songjun Wu 2015-03-12 748 wm8731->mclk = devm_clk_get(&i2c->dev, "mclk");
99d422341 Songjun Wu 2015-03-12 749 if (IS_ERR(wm8731->mclk)) {
99d422341 Songjun Wu 2015-03-12 750 ret = PTR_ERR(wm8731->mclk);
99d422341 Songjun Wu 2015-03-12 751 if (ret == -ENOENT) {
99d422341 Songjun Wu 2015-03-12 752 wm8731->mclk = NULL;
99d422341 Songjun Wu 2015-03-12 753 dev_warn(&i2c->dev, "Assuming static MCLK\n");
99d422341 Songjun Wu 2015-03-12 754 } else {
99d422341 Songjun Wu 2015-03-12 755 dev_err(&i2c->dev, "Failed to get MCLK: %d\n",
99d422341 Songjun Wu 2015-03-12 756 ret);
99d422341 Songjun Wu 2015-03-12 757 return ret;
99d422341 Songjun Wu 2015-03-12 758 }
99d422341 Songjun Wu 2015-03-12 759 }
99d422341 Songjun Wu 2015-03-12 760
8a6cf30bf Manuel Lauss 2015-01-19 761 mutex_init(&wm8731->lock);
8a6cf30bf Manuel Lauss 2015-01-19 762
6702dfcc5 Sergey Kiselev 2015-06-05 763 i2c_set_clientdata(i2c, wm8731);
6702dfcc5 Sergey Kiselev 2015-06-05 764
6702dfcc5 Sergey Kiselev 2015-06-05 @765 ret = wm8731_request_supplies(&i2c->dev, wm8731);
6702dfcc5 Sergey Kiselev 2015-06-05 766 if (ret != 0)
6702dfcc5 Sergey Kiselev 2015-06-05 767 return ret;
6702dfcc5 Sergey Kiselev 2015-06-05 768
f1992dde7 Mark Brown 2012-05-12 769 wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
05d448e2c Mark Brown 2011-11-21 770 if (IS_ERR(wm8731->regmap)) {
05d448e2c Mark Brown 2011-11-21 771 ret = PTR_ERR(wm8731->regmap);
05d448e2c Mark Brown 2011-11-21 772 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
05d448e2c Mark Brown 2011-11-21 773 ret);
f1992dde7 Mark Brown 2012-05-12 774 return ret;
05d448e2c Mark Brown 2011-11-21 775 }
05d448e2c Mark Brown 2011-11-21 776
6702dfcc5 Sergey Kiselev 2015-06-05 @777 ret = wm8731_hw_init(&i2c->dev, wm8731);
6702dfcc5 Sergey Kiselev 2015-06-05 778 if (ret != 0)
6702dfcc5 Sergey Kiselev 2015-06-05 779 return ret;
a8035c8f0 Mark Brown 2009-02-16 780
cde596c7c Kuninori Morimoto 2018-01-29 781 ret = devm_snd_soc_register_component(&i2c->dev,
cde596c7c Kuninori Morimoto 2018-01-29 782 &soc_component_dev_wm8731, &wm8731_dai, 1);
05d448e2c Mark Brown 2011-11-21 783 if (ret != 0) {
05d448e2c Mark Brown 2011-11-21 784 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
f1992dde7 Mark Brown 2012-05-12 785 return ret;
05d448e2c Mark Brown 2011-11-21 786 }
05d448e2c Mark Brown 2011-11-21 787
05d448e2c Mark Brown 2011-11-21 788 return 0;
a8035c8f0 Mark Brown 2009-02-16 789 }
a8035c8f0 Mark Brown 2009-02-16 790

:::::: The code at line 777 was first introduced by commit
:::::: 6702dfcc571d962df499f7466f54e07d044e6cd1 ASoC: wm8731: initialize the hardware when loading the codec driver

:::::: TO: Sergey Kiselev <[email protected]>
:::::: CC: Mark Brown <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (7.90 kB)
.config.gz (35.73 kB)
Download all attachments