Skip to content

Commit 638f958

Browse files
geertuchanwoochoi
authored andcommitted
extcon: Allow compile test of GPIO consumers if !GPIOLIB
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>
1 parent c571bbb commit 638f958

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

drivers/extcon/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ config EXTCON_AXP288
3737

3838
config EXTCON_GPIO
3939
tristate "GPIO extcon support"
40-
depends on GPIOLIB
40+
depends on GPIOLIB || COMPILE_TEST
4141
help
4242
Say Y here to enable GPIO based extcon support. Note that GPIO
4343
extcon supports single state per extcon instance.
@@ -112,7 +112,7 @@ config EXTCON_SM5502
112112

113113
config EXTCON_USB_GPIO
114114
tristate "USB GPIO extcon support"
115-
depends on GPIOLIB
115+
depends on GPIOLIB || COMPILE_TEST
116116
help
117117
Say Y here to enable GPIO based USB cable detection extcon support.
118118
Used typically if GPIO is used for USB ID pin detection.

drivers/extcon/extcon-usb-gpio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include <linux/extcon.h>
18+
#include <linux/gpio/consumer.h>
1819
#include <linux/init.h>
1920
#include <linux/interrupt.h>
2021
#include <linux/irq.h>

0 commit comments

Comments
 (0)