linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: wm8731: Fix a unused function gcc warning
@ 2018-09-30  1:45 zhong jiang
  2018-09-30  2:17 ` Joe Perches
  2018-09-30  2:25 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: zhong jiang @ 2018-09-30  1:45 UTC (permalink / raw)
  To: broonie; +Cc: perex, tiwai, lgirdwood, linux-kernel

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@huawei.com>
---
 sound/soc/codecs/wm8731.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 7c8fad8..b5dc6ba2 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -36,12 +36,15 @@
 #include "wm8731.h"
 
 #define WM8731_NUM_SUPPLIES 4
+
+#if defined(CONFIG_I2C) || defined(CONFIG_SPI_MASTER)
 static const char *wm8731_supply_names[WM8731_NUM_SUPPLIES] = {
 	"AVDD",
 	"HPVDD",
 	"DCVDD",
 	"DBVDD",
 };
+#endif
 
 /* codec private data */
 struct wm8731_priv {
@@ -572,6 +575,7 @@ static int wm8731_startup(struct snd_pcm_substream *substream,
 	.symmetric_rates = 1,
 };
 
+#if defined(CONFIG_I2C) || defined(CONFIG_SPI_MASTER)
 static int wm8731_request_supplies(struct device *dev,
 		struct wm8731_priv *wm8731)
 {
@@ -627,6 +631,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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: wm8731: Fix a unused function gcc warning
  2018-09-30  1:45 [PATCH] ASoC: wm8731: Fix a unused function gcc warning zhong jiang
@ 2018-09-30  2:17 ` Joe Perches
  2018-09-30  2:32   ` zhong jiang
  2018-09-30  2:25 ` kbuild test robot
  1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2018-09-30  2:17 UTC (permalink / raw)
  To: zhong jiang, broonie; +Cc: perex, tiwai, lgirdwood, linux-kernel

On Sun, 2018-09-30 at 09:45 +0800, zhong jiang wrote:
> 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]
[]
> diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
[]
> @@ -36,12 +36,15 @@
>  #include "wm8731.h"
>  
>  #define WM8731_NUM_SUPPLIES 4
> +
> +#if defined(CONFIG_I2C) || defined(CONFIG_SPI_MASTER)
>  static const char *wm8731_supply_names[WM8731_NUM_SUPPLIES] = {
>  	"AVDD",
>  	"HPVDD",
>  	"DCVDD",
>  	"DBVDD",
>  };
> +#endif
>  
>  /* codec private data */
>  struct wm8731_priv {
> @@ -572,6 +575,7 @@ static int wm8731_startup(struct snd_pcm_substream *substream,
>  	.symmetric_rates = 1,
>  };
>  
> +#if defined(CONFIG_I2C) || defined(CONFIG_SPI_MASTER)
>  static int wm8731_request_supplies(struct device *dev,
>  		struct wm8731_priv *wm8731)
>  {
> @@ -627,6 +631,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
>  
>  	return ret;
>  }
> +#endif

It would be better to move the declaration of
wm8731_supply_ fnames into the second #if block so
there would only be a single #if block.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: wm8731: Fix a unused function gcc warning
  2018-09-30  1:45 [PATCH] ASoC: wm8731: Fix a unused function gcc warning zhong jiang
  2018-09-30  2:17 ` Joe Perches
@ 2018-09-30  2:25 ` kbuild test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2018-09-30  2:25 UTC (permalink / raw)
  To: zhong jiang; +Cc: kbuild-all, broonie, perex, tiwai, lgirdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 5537 bytes --]

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-095901
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: i386-randconfig-x070-201839 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   sound/soc/codecs/wm8731.c: In function 'wm8731_i2c_probe':
>> sound/soc/codecs/wm8731.c:767:8: error: implicit declaration of function 'wm8731_request_supplies' [-Werror=implicit-function-declaration]
     ret = wm8731_request_supplies(&i2c->dev, wm8731);
           ^~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/codecs/wm8731.c:779:8: error: implicit declaration of function 'wm8731_hw_init'; did you mean 'wm8731_hw_params'? [-Werror=implicit-function-declaration]
     ret = wm8731_hw_init(&i2c->dev, wm8731);
           ^~~~~~~~~~~~~~
           wm8731_hw_params
   cc1: some warnings being treated as errors

vim +/wm8731_request_supplies +767 sound/soc/codecs/wm8731.c

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

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

:::::: TO: Sergey Kiselev <sergey.kiselev@intel.com>
:::::: CC: Mark Brown <broonie@kernel.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29854 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: wm8731: Fix a unused function gcc warning
  2018-09-30  2:17 ` Joe Perches
@ 2018-09-30  2:32   ` zhong jiang
  0 siblings, 0 replies; 4+ messages in thread
From: zhong jiang @ 2018-09-30  2:32 UTC (permalink / raw)
  To: Joe Perches; +Cc: broonie, perex, tiwai, lgirdwood, linux-kernel

On 2018/9/30 10:17, Joe Perches wrote:
> On Sun, 2018-09-30 at 09:45 +0800, zhong jiang wrote:
>> 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]
> []
>> diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
> []
>> @@ -36,12 +36,15 @@
>>  #include "wm8731.h"
>>  
>>  #define WM8731_NUM_SUPPLIES 4
>> +
>> +#if defined(CONFIG_I2C) || defined(CONFIG_SPI_MASTER)
>>  static const char *wm8731_supply_names[WM8731_NUM_SUPPLIES] = {
>>  	"AVDD",
>>  	"HPVDD",
>>  	"DCVDD",
>>  	"DBVDD",
>>  };
>> +#endif
>>  
>>  /* codec private data */
>>  struct wm8731_priv {
>> @@ -572,6 +575,7 @@ static int wm8731_startup(struct snd_pcm_substream *substream,
>>  	.symmetric_rates = 1,
>>  };
>>  
>> +#if defined(CONFIG_I2C) || defined(CONFIG_SPI_MASTER)
>>  static int wm8731_request_supplies(struct device *dev,
>>  		struct wm8731_priv *wm8731)
>>  {
>> @@ -627,6 +631,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
>>  
>>  	return ret;
>>  }
>> +#endif
> It would be better to move the declaration of
> wm8731_supply_ fnames into the second #if block so
> there would only be a single #if block.
>
Yep,  Thanks,  Will repost in v2.

Sincerely,
zhong jiang


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-30  2:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-30  1:45 [PATCH] ASoC: wm8731: Fix a unused function gcc warning zhong jiang
2018-09-30  2:17 ` Joe Perches
2018-09-30  2:32   ` zhong jiang
2018-09-30  2:25 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).