sound/soc/codecs/max98927.c:902:19: error: implicit declaration of function 'devm_gpiod_get_optional'; did you mean 'devm_regulator_get_optional'?

From: kernel test robot
Date: Mon Jan 24 2022 - 03:46:30 EST


Hi Alejandro,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
commit: 4d67dc1998f1890a9d22d03208037075ea9f2562 ASoC: max98927: Handle reset gpio when probing i2c
date: 4 months ago
config: alpha-randconfig-r034-20220123 (https://download.01.org/0day-ci/archive/20220124/202201241652.HcxYQUSR-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4d67dc1998f1890a9d22d03208037075ea9f2562
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 4d67dc1998f1890a9d22d03208037075ea9f2562
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=alpha SHELL=/bin/bash sound/soc/codecs/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

sound/soc/codecs/max98927.c: In function 'max98927_i2c_probe':
>> sound/soc/codecs/max98927.c:902:19: error: implicit declaration of function 'devm_gpiod_get_optional'; did you mean 'devm_regulator_get_optional'? [-Werror=implicit-function-declaration]
902 | = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH);
| ^~~~~~~~~~~~~~~~~~~~~~~
| devm_regulator_get_optional
>> sound/soc/codecs/max98927.c:902:63: error: 'GPIOD_OUT_HIGH' undeclared (first use in this function); did you mean 'GPIOF_INIT_HIGH'?
902 | = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH);
| ^~~~~~~~~~~~~~
| GPIOF_INIT_HIGH
sound/soc/codecs/max98927.c:902:63: note: each undeclared identifier is reported only once for each function it appears in
>> sound/soc/codecs/max98927.c:909:17: error: implicit declaration of function 'gpiod_set_value_cansleep'; did you mean 'gpio_set_value_cansleep'? [-Werror=implicit-function-declaration]
909 | gpiod_set_value_cansleep(max98927->reset_gpio, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| gpio_set_value_cansleep
cc1: some warnings being treated as errors


vim +902 sound/soc/codecs/max98927.c

867
868 int ret = 0, value;
869 int reg = 0;
870 struct max98927_priv *max98927 = NULL;
871
872 max98927 = devm_kzalloc(&i2c->dev,
873 sizeof(*max98927), GFP_KERNEL);
874
875 if (!max98927) {
876 ret = -ENOMEM;
877 return ret;
878 }
879 i2c_set_clientdata(i2c, max98927);
880
881 /* update interleave mode info */
882 if (!of_property_read_u32(i2c->dev.of_node,
883 "interleave_mode", &value)) {
884 if (value > 0)
885 max98927->interleave_mode = true;
886 else
887 max98927->interleave_mode = false;
888 } else
889 max98927->interleave_mode = false;
890
891 /* regmap initialization */
892 max98927->regmap
893 = devm_regmap_init_i2c(i2c, &max98927_regmap);
894 if (IS_ERR(max98927->regmap)) {
895 ret = PTR_ERR(max98927->regmap);
896 dev_err(&i2c->dev,
897 "Failed to allocate regmap: %d\n", ret);
898 return ret;
899 }
900
901 max98927->reset_gpio
> 902 = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH);
903 if (IS_ERR(max98927->reset_gpio)) {
904 ret = PTR_ERR(max98927->reset_gpio);
905 return dev_err_probe(&i2c->dev, ret, "failed to request GPIO reset pin");
906 }
907
908 if (max98927->reset_gpio) {
> 909 gpiod_set_value_cansleep(max98927->reset_gpio, 0);
910 /* Wait for i2c port to be ready */
911 usleep_range(5000, 6000);
912 }
913
914 /* Check Revision ID */
915 ret = regmap_read(max98927->regmap,
916 MAX98927_R01FF_REV_ID, &reg);
917 if (ret < 0) {
918 dev_err(&i2c->dev,
919 "Failed to read: 0x%02X\n", MAX98927_R01FF_REV_ID);
920 return ret;
921 }
922 dev_info(&i2c->dev, "MAX98927 revisionID: 0x%02X\n", reg);
923
924 /* voltage/current slot configuration */
925 max98927_slot_config(i2c, max98927);
926
927 /* codec registeration */
928 ret = devm_snd_soc_register_component(&i2c->dev,
929 &soc_component_dev_max98927,
930 max98927_dai, ARRAY_SIZE(max98927_dai));
931 if (ret < 0)
932 dev_err(&i2c->dev, "Failed to register component: %d\n", ret);
933
934 return ret;
935 }
936

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx