Skip to content

Commit 678bae2

Browse files
arndbBartosz Golaszewski
authored andcommitted
gpiolib: make legacy interfaces optional
The traditional interfaces are only used on a small number of ancient boards. Make these optional now so they can be disabled by default. Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Alexander Sverdlin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 8c7a860 commit 678bae2

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

drivers/gpio/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ menuconfig GPIOLIB
1414

1515
if GPIOLIB
1616

17+
config GPIOLIB_LEGACY
18+
def_bool y
19+
1720
config GPIOLIB_FASTPATH_LIMIT
1821
int "Maximum number of GPIOs for fast path"
1922
range 32 512

drivers/gpio/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG
55

66
obj-$(CONFIG_GPIOLIB) += gpiolib.o
77
obj-$(CONFIG_GPIOLIB) += gpiolib-devres.o
8-
obj-$(CONFIG_GPIOLIB) += gpiolib-legacy.o
8+
obj-$(CONFIG_GPIOLIB_LEGACY) += gpiolib-legacy.o
99
obj-$(CONFIG_OF_GPIO) += gpiolib-of.o
1010
obj-$(CONFIG_GPIO_CDEV) += gpiolib-cdev.o
1111
obj-$(CONFIG_GPIO_SYSFS) += gpiolib-sysfs.o

include/linux/gpio.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
#define __LINUX_GPIO_H
1414

1515
#include <linux/types.h>
16+
#ifdef CONFIG_GPIOLIB
17+
#include <linux/gpio/consumer.h>
18+
#endif
19+
20+
#ifdef CONFIG_GPIOLIB_LEGACY
1621

1722
struct device;
1823

@@ -22,9 +27,6 @@ struct device;
2227
#define GPIOF_OUT_INIT_HIGH ((0 << 0) | (1 << 1))
2328

2429
#ifdef CONFIG_GPIOLIB
25-
26-
#include <linux/gpio/consumer.h>
27-
2830
/*
2931
* "valid" GPIO numbers are nonnegative and may be passed to
3032
* setup routines like gpio_request(). Only some valid numbers
@@ -170,5 +172,5 @@ static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
170172
}
171173

172174
#endif /* ! CONFIG_GPIOLIB */
173-
175+
#endif /* CONFIG_GPIOLIB_LEGACY */
174176
#endif /* __LINUX_GPIO_H */

0 commit comments

Comments
 (0)