Skip to contentSkip to conversation

drivers/media/rc/gpio-ir-recv.c:38:8: error: implicit declaration of function 'gpiod_get_value'

PATCH In review kbuild test robot 3 participants 5 messages Oct 5, 2017

Subsystems (2)
lore
Share & tools
lore

kbuild test robot

author build bot
#0 lore raw
tree:   git://git.ragnatech.se/linux media-tree
head:   a8c779eb056e9874c6278151ade857c3ac227db9
commit: eed008e605d13ee4fb64668350be58999e85aac7 [2692/2696] [media] media: rc: gpio-ir-recv: use gpiolib API
config: x86_64-randconfig-s4-10051614 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout eed008e605d13ee4fb64668350be58999e85aac7
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

drivers/media/rc/gpio-ir-recv.c: In function 'gpio_ir_recv_irq':

>> drivers/media/rc/gpio-ir-recv.c:38:8: error: implicit declaration of function 'gpiod_get_value' [-Werror=implicit-function-declaration]
     val = gpiod_get_value(gpio_dev->gpiod);
           ^~~~~~~~~~~~~~~
   drivers/media/rc/gpio-ir-recv.c: In function 'gpio_ir_recv_probe':
>> drivers/media/rc/gpio-ir-recv.c:60:20: error: implicit declaration of function 'devm_gpiod_get' [-Werror=implicit-function-declaration]
     gpio_dev->gpiod = devm_gpiod_get(dev, NULL, GPIOD_IN);
                       ^~~~~~~~~~~~~~
>> drivers/media/rc/gpio-ir-recv.c:60:46: error: 'GPIOD_IN' undeclared (first use in this function)
     gpio_dev->gpiod = devm_gpiod_get(dev, NULL, GPIOD_IN);
                                                 ^~~~~~~~
   drivers/media/rc/gpio-ir-recv.c:60:46: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/media/rc/gpio-ir-recv.c:68:18: error: implicit declaration of function 'gpiod_to_irq' [-Werror=implicit-function-declaration]
     gpio_dev->irq = gpiod_to_irq(gpio_dev->gpiod);
                     ^~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/gpiod_get_value +38 drivers/media/rc/gpio-ir-recv.c

    32	
    33	static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id)
    34	{
    35		int val;
    36		struct gpio_rc_dev *gpio_dev = dev_id;
    37	
  > 38		val = gpiod_get_value(gpio_dev->gpiod);
    39		if (val >= 0)
    40			ir_raw_event_store_edge(gpio_dev->rcdev, val == 1);
    41	
    42		return IRQ_HANDLED;
    43	}
    44	
    45	static int gpio_ir_recv_probe(struct platform_device *pdev)
    46	{
    47		struct device *dev = &pdev->dev;
    48		struct device_node *np = dev->of_node;
    49		struct gpio_rc_dev *gpio_dev;
    50		struct rc_dev *rcdev;
    51		int rc;
    52	
    53		if (!np)
    54			return -ENODEV;
    55	
    56		gpio_dev = devm_kzalloc(dev, sizeof(*gpio_dev), GFP_KERNEL);
    57		if (!gpio_dev)
    58			return -ENOMEM;
    59	
  > 60		gpio_dev->gpiod = devm_gpiod_get(dev, NULL, GPIOD_IN);
    61		if (IS_ERR(gpio_dev->gpiod)) {
    62			rc = PTR_ERR(gpio_dev->gpiod);
    63			/* Just try again if this happens */
    64			if (rc != -EPROBE_DEFER)
    65				dev_err(dev, "error getting gpio (%d)\n", rc);
    66			return rc;
    67		}
  > 68		gpio_dev->irq = gpiod_to_irq(gpio_dev->gpiod);
    69		if (gpio_dev->irq < 0)
    70			return gpio_dev->irq;
    71	
    72		rcdev = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW);
    73		if (!rcdev)
    74			return -ENOMEM;
    75	
    76		rcdev->priv = gpio_dev;
    77		rcdev->device_name = GPIO_IR_DEVICE_NAME;
    78		rcdev->input_phys = GPIO_IR_DEVICE_NAME "/input0";
    79		rcdev->input_id.bustype = BUS_HOST;
    80		rcdev->input_id.vendor = 0x0001;
    81		rcdev->input_id.product = 0x0001;
    82		rcdev->input_id.version = 0x0100;
    83		rcdev->dev.parent = dev;
    84		rcdev->driver_name = KBUILD_MODNAME;
    85		rcdev->min_timeout = 1;
    86		rcdev->timeout = IR_DEFAULT_TIMEOUT;
    87		rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
    88		rcdev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
    89		rcdev->map_name = of_get_property(np, "linux,rc-map-name", NULL);
    90		if (!rcdev->map_name)
    91			rcdev->map_name = RC_MAP_EMPTY;
    92	
    93		gpio_dev->rcdev = rcdev;
    94	
    95		rc = devm_rc_register_device(dev, rcdev);
    96		if (rc < 0) {
    97			dev_err(dev, "failed to register rc device (%d)\n", rc);
    98			return rc;
    99		}

100
101 platform_set_drvdata(pdev, gpio_dev);
102
103 return devm_request_irq(dev, gpio_dev->irq, gpio_ir_recv_irq,
104 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
105 "gpio-ir-recv-irq", gpio_dev);
106 }
107

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

maintainer
#1 lore raw

PATCH 1/1 media: rc: fix gpio-ir-receiver build failure

The 0-day robot reports:

drivers/media/rc/gpio-ir-recv.c: In function 'gpio_ir_recv_irq':

Quoted 1 line
Quoted 1 line

drivers/media/rc/gpio-ir-recv.c:38:8: error: implicit declaration of function 'gpiod_get_value' [-Werror=implicit-function-declaration]

Fixes eed008e605d1 ("[media] media: rc: gpio-ir-recv: use gpiolib API")
---
 drivers/media/rc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/media/rc/Kconfig +1 -0
index 467cf2bdbd42..b9ae0cb01a53 100644
@@ -392,6 +392,7 @@ config RC_LOOPBACK
 config IR_GPIO_CIR
 	tristate "GPIO IR remote control"
 	depends on RC_CORE
+	depends on GPIOLIB
 	---help---
 	   Say Y if you want to use GPIO based IR Receiver.
 
Signature · 1 line
2.13.6
#2 lore raw

Re: [PATCH] media: rc: fix gpio-ir-receiver build failure

Quoted 18 lines · Sean Young

The 0-day robot reports:

drivers/media/rc/gpio-ir-recv.c: In function 'gpio_ir_recv_irq':

Quoted 1 line
Quoted 1 line

drivers/media/rc/gpio-ir-recv.c:38:8: error: implicit declaration of function 'gpiod_get_value' [-Werror=implicit-function-declaration]

Fixes eed008e605d1 ("[media] media: rc: gpio-ir-recv: use gpiolib API")
---
 drivers/media/rc/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/media/rc/Kconfig +0 -0
index 467cf2bdbd42..b9ae0cb01a53 100644

drivers/media/rc/Kconfig config RC_LOOPBACK · line 397

Quoted 6 lines
drivers/media/rc/Kconfig +1 -0
@@ -392,6 +392,7 @@ config RC_LOOPBACK
 config IR_GPIO_CIR
 	tristate "GPIO IR remote control"
 	depends on RC_CORE
+	depends on GPIOLIB
 	---help---
 	   Say Y if you want to use GPIO based IR Receiver.

Hmm, following was part of patch I sent. What happened to it?

drivers/media/rc/Kconfig +1 -0
index d9ce8ff55d0c..6bfe983ff295 100644
@@ -393,6 +393,7 @@ config RC_LOOPBACK
 config IR_GPIO_CIR
        tristate "GPIO IR remote control"
        depends on RC_CORE
+       depends on (OF && GPIOLIB) || COMPILE_TEST
        ---help---
           Say Y if you want to use GPIO based IR Receiver.
 

Just compare:
https://patchwork.linuxtv.org/patch/43918/
and
https://git.linuxtv.org/media_tree.git/commit/?id=eed008e605d13ee4fb64668350be58999e85aac7

Also, fix appears to be:

drivers/media/rc/gpio-ir-recv.c +1 -1
index 5bb0851eacce..b6c4a2d2b696 100644
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
#3 lore raw

PATCH v2 1/1 media: rc: fix gpio-ir-receiver build failure

In reply to kbuild test robot

The 0-day robot reports:

drivers/media/rc/gpio-ir-recv.c: In function 'gpio_ir_recv_irq':

Quoted 1 line
Quoted 1 line

drivers/media/rc/gpio-ir-recv.c:38:8: error: implicit declaration of function 'gpiod_get_value' [-Werror=implicit-function-declaration]

Fixes eed008e605d1 ("[media] media: rc: gpio-ir-recv: use gpiolib API")

For some reason only partial patch was applied. Also include gpio/consumer.h otherwise compile test fails.

---
Changes:
-v2: replace Sean's patch with something I believe is more accurate

 drivers/media/rc/Kconfig        |    1 +
 drivers/media/rc/gpio-ir-recv.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/media/rc/Kconfig +1 -0
index d9ce8ff55d0c..6bfe983ff295 100644
@@ -393,6 +393,7 @@ config RC_LOOPBACK
 config IR_GPIO_CIR
 	tristate "GPIO IR remote control"
 	depends on RC_CORE
+	depends on (OF && GPIOLIB) || COMPILE_TEST
 	---help---
 	   Say Y if you want to use GPIO based IR Receiver.
 
drivers/media/rc/gpio-ir-recv.c +1 -1
index 5bb0851eacce..b6c4a2d2b696 100644
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
maintainer Acked-by on v2 1/1
#4 lore raw

Re: [PATCH v2] media: rc: fix gpio-ir-receiver build failure

Quoted 7 lines · Ladislav Michl

The 0-day robot reports:

drivers/media/rc/gpio-ir-recv.c: In function 'gpio_ir_recv_irq':

Quoted 1 line
Quoted 1 line

drivers/media/rc/gpio-ir-recv.c:38:8: error: implicit declaration of function 'gpiod_get_value' [-Werror=implicit-function-declaration]

Fixes eed008e605d1 ("[media] media: rc: gpio-ir-recv: use gpiolib API")
Quoted 8 lines

For some reason only partial patch was applied. Also include gpio/consumer.h otherwise compile test fails.

---
Changes:
-v2: replace Sean's patch with something I believe is more accurate

Yes, your change is right. Thanks for pointing that out. Actually there are more device tree rc drivers that need a "depends on OF || TEST_COMPILE".

Quoted 30 lines
 drivers/media/rc/Kconfig        |    1 +
 drivers/media/rc/gpio-ir-recv.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/media/rc/Kconfig +1 -0
index d9ce8ff55d0c..6bfe983ff295 100644
@@ -393,6 +393,7 @@ config RC_LOOPBACK
 config IR_GPIO_CIR
 	tristate "GPIO IR remote control"
 	depends on RC_CORE
+	depends on (OF && GPIOLIB) || COMPILE_TEST
 	---help---
 	   Say Y if you want to use GPIO based IR Receiver.
 
drivers/media/rc/gpio-ir-recv.c +1 -1
index 5bb0851eacce..b6c4a2d2b696 100644
@@ -14,7 +14,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>