Re: sound/soc//codecs/ak4118.c:297:2: error: implicit declaration of function 'gpiod_set_value'

From: ClÃment PÃron
Date: Mon Feb 04 2019 - 10:19:47 EST


Hi,

There is a header missing "linux/gpio/consumer.h"

I will propose a patch.

Regards,
Clement

On Sun, 3 Feb 2019 at 03:43, kbuild test robot <lkp@xxxxxxxxx> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: f17b5f06cb92ef2250513a1e154c47b78df07d40
> commit: bf897b441bd3afdd43e19605df4fb5a105678664 ASoC: ak4118: Add support for AK4118 S/PDIF transceiver
> date: 3 months ago
> config: x86_64-randconfig-s0-02030926 (attached as .config)
> compiler: gcc-6 (Debian 6.5.0-2) 6.5.0 20181026
> reproduce:
> git checkout bf897b441bd3afdd43e19605df4fb5a105678664
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All errors (new ones prefixed by >>):
>
> sound/soc//codecs/ak4118.c: In function 'ak4118_probe':
> >> sound/soc//codecs/ak4118.c:297:2: error: implicit declaration of function 'gpiod_set_value' [-Werror=implicit-function-declaration]
> gpiod_set_value(ak4118->reset, 0);
> ^~~~~~~~~~~~~~~
> sound/soc//codecs/ak4118.c: In function 'ak4118_i2c_probe':
> >> sound/soc//codecs/ak4118.c:377:18: error: implicit declaration of function 'devm_gpiod_get' [-Werror=implicit-function-declaration]
> ak4118->reset = devm_gpiod_get(&i2c->dev, "reset", GPIOD_OUT_HIGH);
> ^~~~~~~~~~~~~~
> >> sound/soc//codecs/ak4118.c:377:53: error: 'GPIOD_OUT_HIGH' undeclared (first use in this function)
> ak4118->reset = devm_gpiod_get(&i2c->dev, "reset", GPIOD_OUT_HIGH);
> ^~~~~~~~~~~~~~
> sound/soc//codecs/ak4118.c:377:53: note: each undeclared identifier is reported only once for each function it appears in
> >> sound/soc//codecs/ak4118.c:385:49: error: 'GPIOD_IN' undeclared (first use in this function)
> ak4118->irq = devm_gpiod_get(&i2c->dev, "irq", GPIOD_IN);
> ^~~~~~~~
> >> sound/soc//codecs/ak4118.c:393:45: error: implicit declaration of function 'gpiod_to_irq' [-Werror=implicit-function-declaration]
> ret = devm_request_threaded_irq(&i2c->dev, gpiod_to_irq(ak4118->irq),
> ^~~~~~~~~~~~
> cc1: some warnings being treated as errors
>
> vim +/gpiod_set_value +297 sound/soc//codecs/ak4118.c
>
> 288
> 289 static int ak4118_probe(struct snd_soc_component *component)
> 290 {
> 291 struct ak4118_priv *ak4118 = snd_soc_component_get_drvdata(component);
> 292 int ret = 0;
> 293
> 294 ak4118->component = component;
> 295
> 296 /* release reset */
> > 297 gpiod_set_value(ak4118->reset, 0);
> 298
> 299 /* unmask all int1 sources */
> 300 ret = regmap_write(ak4118->regmap, AK4118_REG_INT1_MASK, 0x00);
> 301 if (ret < 0) {
> 302 dev_err(component->dev,
> 303 "failed to write regmap 0x%x 0x%x: %d\n",
> 304 AK4118_REG_INT1_MASK, 0x00, ret);
> 305 return ret;
> 306 }
> 307
> 308 /* rx detect enable on all channels */
> 309 ret = regmap_write(ak4118->regmap, AK4118_REG_RX_DETECT, 0xff);
> 310 if (ret < 0) {
> 311 dev_err(component->dev,
> 312 "failed to write regmap 0x%x 0x%x: %d\n",
> 313 AK4118_REG_RX_DETECT, 0xff, ret);
> 314 return ret;
> 315 }
> 316
> 317 ret = snd_soc_add_component_controls(component, ak4118_iec958_controls,
> 318 ARRAY_SIZE(ak4118_iec958_controls));
> 319 if (ret) {
> 320 dev_err(component->dev,
> 321 "failed to add component kcontrols: %d\n", ret);
> 322 return ret;
> 323 }
> 324
> 325 return 0;
> 326 }
> 327
> 328 static void ak4118_remove(struct snd_soc_component *component)
> 329 {
> 330 struct ak4118_priv *ak4118 = snd_soc_component_get_drvdata(component);
> 331
> 332 /* hold reset */
> 333 gpiod_set_value(ak4118->reset, 1);
> 334 }
> 335
> 336 static const struct snd_soc_component_driver soc_component_drv_ak4118 = {
> 337 .probe = ak4118_probe,
> 338 .remove = ak4118_remove,
> 339 .dapm_widgets = ak4118_dapm_widgets,
> 340 .num_dapm_widgets = ARRAY_SIZE(ak4118_dapm_widgets),
> 341 .dapm_routes = ak4118_dapm_routes,
> 342 .num_dapm_routes = ARRAY_SIZE(ak4118_dapm_routes),
> 343 .idle_bias_on = 1,
> 344 .use_pmdown_time = 1,
> 345 .endianness = 1,
> 346 .non_legacy_dai_naming = 1,
> 347 };
> 348
> 349 static const struct regmap_config ak4118_regmap = {
> 350 .reg_bits = 8,
> 351 .val_bits = 8,
> 352
> 353 .reg_defaults = ak4118_reg_defaults,
> 354 .num_reg_defaults = ARRAY_SIZE(ak4118_reg_defaults),
> 355
> 356 .cache_type = REGCACHE_NONE,
> 357 .max_register = AK4118_REG_MAX - 1,
> 358 };
> 359
> 360 static int ak4118_i2c_probe(struct i2c_client *i2c,
> 361 const struct i2c_device_id *id)
> 362 {
> 363 struct ak4118_priv *ak4118;
> 364 int ret;
> 365
> 366 ak4118 = devm_kzalloc(&i2c->dev, sizeof(struct ak4118_priv),
> 367 GFP_KERNEL);
> 368 if (ak4118 == NULL)
> 369 return -ENOMEM;
> 370
> 371 ak4118->regmap = devm_regmap_init_i2c(i2c, &ak4118_regmap);
> 372 if (IS_ERR(ak4118->regmap))
> 373 return PTR_ERR(ak4118->regmap);
> 374
> 375 i2c_set_clientdata(i2c, ak4118);
> 376
> > 377 ak4118->reset = devm_gpiod_get(&i2c->dev, "reset", GPIOD_OUT_HIGH);
> 378 if (IS_ERR(ak4118->reset)) {
> 379 ret = PTR_ERR(ak4118->reset);
> 380 if (ret != -EPROBE_DEFER)
> 381 dev_err(&i2c->dev, "Failed to get reset: %d\n", ret);
> 382 return ret;
> 383 }
> 384
> > 385 ak4118->irq = devm_gpiod_get(&i2c->dev, "irq", GPIOD_IN);
> 386 if (IS_ERR(ak4118->irq)) {
> 387 ret = PTR_ERR(ak4118->irq);
> 388 if (ret != -EPROBE_DEFER)
> 389 dev_err(&i2c->dev, "Failed to get IRQ: %d\n", ret);
> 390 return ret;
> 391 }
> 392
> > 393 ret = devm_request_threaded_irq(&i2c->dev, gpiod_to_irq(ak4118->irq),
> 394 NULL, ak4118_irq_handler,
> 395 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> 396 "ak4118-irq", ak4118);
> 397 if (ret < 0) {
> 398 dev_err(&i2c->dev, "Fail to request_irq: %d\n", ret);
> 399 return ret;
> 400 }
> 401
> 402 return snd_soc_register_component(&i2c->dev, &soc_component_drv_ak4118,
> 403 &ak4118_dai, 1);
> 404 }
> 405
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation