[-next] ASoc: tas2770: Fix build error without GPIOLIB
diff mbox series

Message ID 20191006072241.56808-1-yuehaibing@huawei.com
State New
Headers show
Series
  • [-next] ASoc: tas2770: Fix build error without GPIOLIB
Related show

Commit Message

Yuehaibing Oct. 6, 2019, 7:22 a.m. UTC
If GPIOLIB is not set, building fails:

sound/soc/codecs/tas2770.c: In function tas2770_reset:
sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]
   gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~
   gpio_set_value_cansleep
sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
  tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
                        ^~~~~~~~~~~~~~~~~~~~~~~
                        devm_regulator_get_optional
sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
             GPIOD_OUT_HIGH);
             ^~~~~~~~~~~~~~
             GPIOF_INIT_HIGH

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 sound/soc/codecs/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Ladislav Michl Oct. 6, 2019, 9:57 a.m. UTC | #1
Dear YueHaibing,

On Sun, Oct 06, 2019 at 03:22:41PM +0800, YueHaibing wrote:
> If GPIOLIB is not set, building fails:
> 
> sound/soc/codecs/tas2770.c: In function tas2770_reset:
> sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]
>    gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
>    ^~~~~~~~~~~~~~~~~~~~~~~~
>    gpio_set_value_cansleep
> sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
> sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
>   tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
>                         ^~~~~~~~~~~~~~~~~~~~~~~
>                         devm_regulator_get_optional
> sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
>              GPIOD_OUT_HIGH);
>              ^~~~~~~~~~~~~~
>              GPIOF_INIT_HIGH
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  sound/soc/codecs/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index bcac957..d639f17 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -1108,6 +1108,7 @@ config SND_SOC_TAS2552
>  config SND_SOC_TAS2770
>  	tristate "Texas Instruments TAS2770 speaker amplifier"
>  	depends on I2C
> +	select GPIOLIB

GPIOLIB API is working perfectly fine even if GPIOLIB is not selected
and gpiod_* functions will merely return -ENOSYS in this case.
Please see <linux/gpio/consumer.h> and fix your patch accordingly.

>  config SND_SOC_TAS5086
>  	tristate "Texas Instruments TAS5086 speaker amplifier"
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Yuehaibing Oct. 6, 2019, 10:06 a.m. UTC | #2
On 2019/10/6 17:57, Ladislav Michl wrote:
> Dear YueHaibing,
> 
> On Sun, Oct 06, 2019 at 03:22:41PM +0800, YueHaibing wrote:
>> If GPIOLIB is not set, building fails:
>>
>> sound/soc/codecs/tas2770.c: In function tas2770_reset:
>> sound/soc/codecs/tas2770.c:38:3: error: implicit declaration of function gpiod_set_value_cansleep; did you mean gpio_set_value_cansleep? [-Werror=implicit-function-declaration]
>>    gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
>>    ^~~~~~~~~~~~~~~~~~~~~~~~
>>    gpio_set_value_cansleep
>> sound/soc/codecs/tas2770.c: In function tas2770_i2c_probe:
>> sound/soc/codecs/tas2770.c:749:24: error: implicit declaration of function devm_gpiod_get_optional; did you mean devm_regulator_get_optional? [-Werror=implicit-function-declaration]
>>   tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev,
>>                         ^~~~~~~~~~~~~~~~~~~~~~~
>>                         devm_regulator_get_optional
>> sound/soc/codecs/tas2770.c:751:13: error: GPIOD_OUT_HIGH undeclared (first use in this function); did you mean GPIOF_INIT_HIGH?
>>              GPIOD_OUT_HIGH);
>>              ^~~~~~~~~~~~~~
>>              GPIOF_INIT_HIGH
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Fixes: 1a476abc723e ("tas2770: add tas2770 smart PA kernel driver")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  sound/soc/codecs/Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
>> index bcac957..d639f17 100644
>> --- a/sound/soc/codecs/Kconfig
>> +++ b/sound/soc/codecs/Kconfig
>> @@ -1108,6 +1108,7 @@ config SND_SOC_TAS2552
>>  config SND_SOC_TAS2770
>>  	tristate "Texas Instruments TAS2770 speaker amplifier"
>>  	depends on I2C
>> +	select GPIOLIB
> 
> GPIOLIB API is working perfectly fine even if GPIOLIB is not selected
> and gpiod_* functions will merely return -ENOSYS in this case.
> Please see <linux/gpio/consumer.h> and fix your patch accordingly.


Thanks, will send v2 as your suggestion.

> 
>>  config SND_SOC_TAS5086
>>  	tristate "Texas Instruments TAS5086 speaker amplifier"
>> -- 
>> 2.7.4
>>
>>
>> _______________________________________________
>> Alsa-devel mailing list
>> Alsa-devel@alsa-project.org
>> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 
> .
>

Patch
diff mbox series

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index bcac957..d639f17 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -1108,6 +1108,7 @@  config SND_SOC_TAS2552
 config SND_SOC_TAS2770
 	tristate "Texas Instruments TAS2770 speaker amplifier"
 	depends on I2C
+	select GPIOLIB
 
 config SND_SOC_TAS5086
 	tristate "Texas Instruments TAS5086 speaker amplifier"