From: Arnd Bergmann <arnd@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "Arnd Bergmann" <arnd@arndb.de>, "Peng Fan" <peng.fan@nxp.com>,
"Lee Jones" <lee@kernel.org>,
"Koichiro Den" <koichiro.den@canonical.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Alexander Sverdlin" <alexander.sverdlin@gmail.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] gpiolib: make legacy interfaces optional
Date: Tue, 22 Jul 2025 17:35:43 +0200 [thread overview]
Message-ID: <20250722153634.3683927-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
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>
---
This is the first patch of a series to turn off the legacy interfaces
by default. If we can still have this one in linux-6.17, we can more
easily merge the other patches for 6.18.
See for the longer series:
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=config-gpio-legacy
I'm sure there are still problems in the other patches, but it
does pass my randconfig build tests on the three architectures
I'm testing on. I plan to post them after some more testing
once -rc1 is out.
drivers/gpio/Kconfig | 3 +++
drivers/gpio/Makefile | 2 +-
include/linux/gpio.h | 10 ++++++----
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 12bdf6e965f1..8bda3c9d47b4 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -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
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 88dedd298256..b01ff2b68bf6 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -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
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index ff99ed76fdc3..8f85ddb26429 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -13,6 +13,11 @@
#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 */
--
2.39.5
next reply other threads:[~2025-07-22 15:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 15:35 Arnd Bergmann [this message]
2025-07-22 16:27 ` Alexander Sverdlin
2025-07-23 8:39 ` Bartosz Golaszewski
2025-07-23 14:17 ` Andy Shevchenko
2025-07-24 14:36 ` Arnd Bergmann
2025-07-24 14:22 ` Arnd Bergmann
2025-07-24 14:24 ` Bartosz Golaszewski
2025-07-23 14:15 ` Andy Shevchenko
2025-07-24 14:25 ` (subset) " Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250722153634.3683927-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=alexander.sverdlin@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=brgl@bgdev.pl \
--cc=geert+renesas@glider.be \
--cc=koichiro.den@canonical.com \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=ukleinek@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®