Skip to contentSkip to conversation

ASoC: samsung: midas_wm1811: Fix build error when CONFIG_GPIOLIB is not set

PATCH In review Wei Yongjun 2 participants 2 messages May 26, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: samsung: midas_wm1811: Fix build error when CONFIG_GPIOLIB is not set

Fix build error when CONFIG_GPIOLIB is not set:

sound/soc/samsung/midas_wm1811.c: In function 'midas_fm_set':
sound/soc/samsung/midas_wm1811.c:205:3: error:
implicit declaration of function 'gpiod_set_value_cansleep';
did you mean 'gpio_set_value_cansleep'? [-Werror=implicit-function-declaration]

  205 |   gpiod_set_value_cansleep(priv->gpio_fm_sel, 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
      |   gpio_set_value_cansleep

sound/soc/samsung/midas_wm1811.c: In function 'midas_probe':
sound/soc/samsung/midas_wm1811.c:445:22: error:
implicit declaration of function 'devm_gpiod_get_optional';
did you mean 'devm_clk_get_optional'? [-Werror=implicit-function-declaration]

  445 |  priv->gpio_fm_sel = devm_gpiod_get_optional(dev, "fm-sel", GPIOD_OUT_HIGH);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~
      |                      devm_clk_get_optional
sound/soc/samsung/midas_wm1811.c:445:61:
 error: 'GPIOD_OUT_HIGH' undeclared (first use in this function);
 did you mean 'GPIOF_INIT_HIGH'?
  445 |  priv->gpio_fm_sel = devm_gpiod_get_optional(dev, "fm-sel", GPIOD_OUT_HIGH);
      |                                                             ^~~~~~~~~~~~~~
      |                                                             GPIOF_INIT_HIGH
Fixes fd0ea9cd9698 ("ASoC: samsung: Add sound support for Midas boards")
---
 sound/soc/samsung/Kconfig | 1 +
 1 file changed, 1 insertion(+)
sound/soc/samsung/Kconfig +1 -0
index a2221ebb1b6a..22be597b1dd9 100644
@@ -228,6 +228,7 @@ config SND_SOC_SAMSUNG_ARIES_WM8994
 config SND_SOC_SAMSUNG_MIDAS_WM1811
 	tristate "SoC I2S Audio support for Midas boards"
 	depends on SND_SOC_SAMSUNG
+	depends on GPIOLIB
 	select SND_SAMSUNG_I2S
 	select SND_SOC_WM8994
 	help
#1 lore raw
Quoted 9 lines · Wei Yongjun

Fix build error when CONFIG_GPIOLIB is not set:

sound/soc/samsung/midas_wm1811.c: In function 'midas_fm_set':
sound/soc/samsung/midas_wm1811.c:205:3: error:
implicit declaration of function 'gpiod_set_value_cansleep';
did you mean 'gpio_set_value_cansleep'? [-Werror=implicit-function-declaration]

  205 |   gpiod_set_value_cansleep(priv->gpio_fm_sel, 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
      |   gpio_set_value_cansleep
Quoted 7 lines

sound/soc/samsung/midas_wm1811.c: In function 'midas_probe':
sound/soc/samsung/midas_wm1811.c:445:22: error:
implicit declaration of function 'devm_gpiod_get_optional';
did you mean 'devm_clk_get_optional'? [-Werror=implicit-function-declaration]

  445 |  priv->gpio_fm_sel = devm_gpiod_get_optional(dev, "fm-sel", GPIOD_OUT_HIGH);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~
      |                      devm_clk_get_optional

The fix does not match the error. The consumer.h has necessary stubs for !GPIOLIB case.

To fix this error, you do not depend on GPIOLIB, but include proper header (consumer.h). The dependency (with compile test) is still nice, but for runtime fix, not build time, which is a separate patch.

Best regards,
Krzysztof

Quoted 27 lines

sound/soc/samsung/midas_wm1811.c:445:61:
error: 'GPIOD_OUT_HIGH' undeclared (first use in this function); did you mean 'GPIOF_INIT_HIGH'?

  445 |  priv->gpio_fm_sel = devm_gpiod_get_optional(dev, "fm-sel", GPIOD_OUT_HIGH);
      |                                                             ^~~~~~~~~~~~~~
      |                                                             GPIOF_INIT_HIGH
Fixes fd0ea9cd9698 ("ASoC: samsung: Add sound support for Midas boards")
---
 sound/soc/samsung/Kconfig | 1 +
 1 file changed, 1 insertion(+)
sound/soc/samsung/Kconfig +1 -0
index a2221ebb1b6a..22be597b1dd9 100644
@@ -228,6 +228,7 @@ config SND_SOC_SAMSUNG_ARIES_WM8994
 config SND_SOC_SAMSUNG_MIDAS_WM1811
 	tristate "SoC I2S Audio support for Midas boards"
 	depends on SND_SOC_SAMSUNG
+	depends on GPIOLIB
 	select SND_SAMSUNG_I2S
 	select SND_SOC_WM8994
 	help