]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpiolib: make legacy interfaces optional
authorArnd Bergmann <arnd@arndb.de>
Tue, 22 Jul 2025 15:35:43 +0000 (17:35 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 24 Jul 2025 14:24:49 +0000 (16:24 +0200)
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 <arnd@arndb.de>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20250722153634.3683927-1-arnd@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/Kconfig
drivers/gpio/Makefile
include/linux/gpio.h

index 6e3c3f0e3dcfeb9a7a16c4ee30ebb9a36cd25f80..500d839f65ee80b8cbb8e9b79e3d02459ad72822 100644 (file)
@@ -14,6 +14,9 @@ menuconfig GPIOLIB
 
 if GPIOLIB
 
+config GPIOLIB_LEGACY
+       def_bool y
+
 config GPIOLIB_FASTPATH_LIMIT
        int "Maximum number of GPIOs for fast path"
        range 32 512
index 3e5bc90ba59e5602de93120ade50a7d13972a2d8..379f55e9ed1e69cd9c5745f8643541b85953db1c 100644 (file)
@@ -5,7 +5,7 @@ ccflags-$(CONFIG_DEBUG_GPIO)    += -DDEBUG
 
 obj-$(CONFIG_GPIOLIB)          += gpiolib.o
 obj-$(CONFIG_GPIOLIB)          += gpiolib-devres.o
-obj-$(CONFIG_GPIOLIB)          += gpiolib-legacy.o
+obj-$(CONFIG_GPIOLIB_LEGACY)   += gpiolib-legacy.o
 obj-$(CONFIG_OF_GPIO)          += gpiolib-of.o
 obj-$(CONFIG_GPIO_CDEV)                += gpiolib-cdev.o
 obj-$(CONFIG_GPIO_SYSFS)       += gpiolib-sysfs.o
index ff99ed76fdc330ce6f67c4665db625cda37a37df..8f85ddb264295d7d13289fa037825e613cfee3e0 100644 (file)
 #define __LINUX_GPIO_H
 
 #include <linux/types.h>
+#ifdef CONFIG_GPIOLIB
+#include <linux/gpio/consumer.h>
+#endif
+
+#ifdef CONFIG_GPIOLIB_LEGACY
 
 struct device;
 
@@ -22,9 +27,6 @@ struct device;
 #define GPIOF_OUT_INIT_HIGH    ((0 << 0) | (1 << 1))
 
 #ifdef CONFIG_GPIOLIB
-
-#include <linux/gpio/consumer.h>
-
 /*
  * "valid" GPIO numbers are nonnegative and may be passed to
  * 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,
 }
 
 #endif /* ! CONFIG_GPIOLIB */
-
+#endif /* CONFIG_GPIOLIB_LEGACY */
 #endif /* __LINUX_GPIO_H */