Skip to contentSkip to conversation

ASoC: amd: acp-da7219-max98357a: Fix -Wunused-variable warning

PATCH In review YueHaibing 2 participants 2 messages Mar 29, 2021

Subsystems (3)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 ASoC: amd: acp-da7219-max98357a: Fix -Wunused-variable warning

While ACPI is not set, make W=1 warns:

sound/soc/amd/acp-da7219-max98357a.c:684:28: warning: ‘cz_rt5682_card’ defined but not used [-Wunused-variable]

 static struct snd_soc_card cz_rt5682_card = {
                            ^~~~~~~~~~~~~~

sound/soc/amd/acp-da7219-max98357a.c:671:28: warning: ‘cz_card’ defined but not used [-Wunused-variable]
static struct snd_soc_card cz_card = {

Use #ifdef block to guard this.

---
 sound/soc/amd/acp-da7219-max98357a.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/amd/acp-da7219-max98357a.c +5 -2
index e65e007fc604..1bf0458e22a8 100644
@@ -47,13 +47,15 @@
 #define DUAL_CHANNEL		2
 #define RT5682_PLL_FREQ (48000 * 512)
 
+extern bool bt_uart_enable;
+void *acp_soc_is_rltk_max(struct device *dev);
+
+#ifdef CONFIG_ACPI
 static struct snd_soc_jack cz_jack;
 static struct clk *da7219_dai_wclk;
 static struct clk *da7219_dai_bclk;
 static struct clk *rt5682_dai_wclk;
 static struct clk *rt5682_dai_bclk;
-extern bool bt_uart_enable;
-void *acp_soc_is_rltk_max(struct device *dev);
 
 static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 {
@@ -692,6 +694,7 @@ static struct snd_soc_card cz_rt5682_card = {
 	.controls = cz_mc_controls,
 	.num_controls = ARRAY_SIZE(cz_mc_controls),
 };
+#endif
 
 void *acp_soc_is_rltk_max(struct device *dev)
 {
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 9 lines · YueHaibing

While ACPI is not set, make W=1 warns:

sound/soc/amd/acp-da7219-max98357a.c:684:28: warning: ‘cz_rt5682_card’ defined but not used [-Wunused-variable]

  static struct snd_soc_card cz_rt5682_card = {
                             ^~~~~~~~~~~~~~

sound/soc/amd/acp-da7219-max98357a.c:671:28: warning: ‘cz_card’ defined but not used [-Wunused-variable]
static struct snd_soc_card cz_card = {

Use #ifdef block to guard this.

For similar kernel warnings, i have previously pushed patch adding ACPI dependency.

But I got below review comment for my patch "[PATCH 2/2] ASoC: amd: fix acpi dependency kernel warning" from Arnd

I would suggest simply dropping the unnecessary #ifdef and ACPI_PTR() guard.

It might be helpful to hide the Kconfig submenu under 'depends on X86 || COMPILE_TEST'.

-
Vijendar

Quoted 37 lines
---
  sound/soc/amd/acp-da7219-max98357a.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/amd/acp-da7219-max98357a.c +5 -2
index e65e007fc604..1bf0458e22a8 100644
@@ -47,13 +47,15 @@
  #define DUAL_CHANNEL		2
  #define RT5682_PLL_FREQ (48000 * 512)
 
+extern bool bt_uart_enable;
+void *acp_soc_is_rltk_max(struct device *dev);
+
+#ifdef CONFIG_ACPI
  static struct snd_soc_jack cz_jack;
  static struct clk *da7219_dai_wclk;
  static struct clk *da7219_dai_bclk;
  static struct clk *rt5682_dai_wclk;
  static struct clk *rt5682_dai_bclk;
-extern bool bt_uart_enable;
-void *acp_soc_is_rltk_max(struct device *dev);
 
  static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
  {
@@ -692,6 +694,7 @@ static struct snd_soc_card cz_rt5682_card = {
  	.controls = cz_mc_controls,
  	.num_controls = ARRAY_SIZE(cz_mc_controls),
  };
+#endif
 
  void *acp_soc_is_rltk_max(struct device *dev)
  {