extcon: Allow compile test of GPIO consumers if !GPIOLIB
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 5 May 2015 16:32:20 +0000 (18:32 +0200)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 19 May 2015 07:39:06 +0000 (16:39 +0900)
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

If GPIOLIB=n and asm-generic/gpio.h is not used:

    drivers/extcon/extcon-usb-gpio.c: In function ‘usb_extcon_detect_cable’:
    drivers/extcon/extcon-usb-gpio.c:63: error: implicit declaration of function ‘gpiod_get_value_cansleep’
    drivers/extcon/extcon-usb-gpio.c: In function ‘usb_extcon_probe’:
    drivers/extcon/extcon-usb-gpio.c:116: error: implicit declaration of function ‘devm_gpiod_get’
    drivers/extcon/extcon-usb-gpio.c:116: warning: assignment makes pointer from integer without a cast
    drivers/extcon/extcon-usb-gpio.c:122: error: implicit declaration of function ‘gpiod_set_debounce’
    drivers/extcon/extcon-usb-gpio.c:129: error: implicit declaration of function ‘gpiod_to_irq’

Add the missing #include <linux/gpio/consumer.h> to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/extcon/Kconfig
drivers/extcon/extcon-usb-gpio.c

index b74e1f27688b55f761b02baa921c8f1a1decedf4..0cebbf668886a82772e152c9fb9cd9aa1e3da3f9 100644 (file)
@@ -37,7 +37,7 @@ config EXTCON_AXP288
 
 config EXTCON_GPIO
        tristate "GPIO extcon support"
-       depends on GPIOLIB
+       depends on GPIOLIB || COMPILE_TEST
        help
          Say Y here to enable GPIO based extcon support. Note that GPIO
          extcon supports single state per extcon instance.
@@ -112,7 +112,7 @@ config EXTCON_SM5502
 
 config EXTCON_USB_GPIO
        tristate "USB GPIO extcon support"
-       depends on GPIOLIB
+       depends on GPIOLIB || COMPILE_TEST
        help
          Say Y here to enable GPIO based USB cable detection extcon support.
          Used typically if GPIO is used for USB ID pin detection.
index e45d1f13f4458e9130d8f052494b33b1a11a9c60..160ec12c2653d03707aff93c6cb3a98ec6764045 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/extcon.h>
+#include <linux/gpio/consumer.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>