* [PATCH 1/2 v7] gpiolib: turn off legacy interface by default
2026-09-07 9:09 [PATCH 0/2 v7] gpiolib: finish the legacy cleanup Arnd Bergmann
@ 2026-09-07 9:09 ` Arnd Bergmann
2026-09-07 9:39 ` Geert Uytterhoeven
2026-09-07 9:09 ` [PATCH 2/2 v7] gpiolib: remove linux/gpio.h Arnd Bergmann
1 sibling, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2026-09-07 9:09 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski
Cc: Arnd Bergmann, Thomas Bogendoerfer, John Paul Adrian Glaubitz,
Kent Gibson, Johannes Berg, linux-kernel, linux-mips, linux-sh,
linux-gpio, linux-wireless, Bartosz Golaszewski, Dmitry Torokhov
From: Arnd Bergmann <arnd@arndb.de>
All users of the legacy interface now select CONFIG_GPIOLIB_LEGACY,
so it can be turned off by default and only get built on platforms
that still have one unconverted driver.
Allow turning it on manually for compile testing, in order to keep
the build coverage of the legacy drivers in allmodconfig and
randconfig.
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> # for input
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpio/Kconfig | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index a48586bb8edb..2b1f6f4c7446 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -4,7 +4,14 @@
#
config GPIOLIB_LEGACY
- def_bool y
+ bool "Legacy GPIO interfaces" if COMPILE_TEST
+ help
+ There are a few legacy platforms that use the traditional GPIO
+ number based interfaces instead of GPIO descriptors.
+ Say Y here to enable build testing drivers that are specific
+ to those platforms.
+
+ If unsure, say N.
config HAVE_SHARED_GPIOS
bool
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2 v7] gpiolib: remove linux/gpio.h
2026-09-07 9:09 [PATCH 0/2 v7] gpiolib: finish the legacy cleanup Arnd Bergmann
2026-09-07 9:09 ` [PATCH 1/2 v7] gpiolib: turn off legacy interface by default Arnd Bergmann
@ 2026-09-07 9:09 ` Arnd Bergmann
2026-09-07 9:50 ` Geert Uytterhoeven
1 sibling, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2026-09-07 9:09 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski
Cc: Arnd Bergmann, Thomas Bogendoerfer, John Paul Adrian Glaubitz,
Kent Gibson, Johannes Berg, linux-kernel, linux-mips, linux-sh,
linux-gpio, linux-wireless, Bartosz Golaszewski
From: Arnd Bergmann <arnd@arndb.de>
After all other drivers have converted to linux/gpio/consumer.h
or linux/gpio/legacy.h, remove the final leftover bits here.
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
MAINTAINERS | 1 -
arch/mips/txx9/rbtx4927/setup.c | 2 +-
arch/sh/boards/mach-rsk/devices-rsk7203.c | 2 +-
drivers/gpio/TODO | 4 +---
drivers/gpio/gpiolib-cdev.c | 2 +-
drivers/gpio/gpiolib-legacy.c | 3 +--
drivers/gpio/gpiolib.c | 2 +-
drivers/net/wireless/morsemicro/mm81x/hw.c | 1 -
drivers/net/wireless/morsemicro/mm81x/yaps.c | 1 -
include/linux/gpio.h | 22 --------------------
10 files changed, 6 insertions(+), 34 deletions(-)
delete mode 100644 include/linux/gpio.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 3a19da74d00c..ee06d678cd59 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11255,7 +11255,6 @@ F: Documentation/devicetree/bindings/gpio/
F: Documentation/driver-api/gpio/
F: drivers/gpio/
F: include/dt-bindings/gpio/
-F: include/linux/gpio.h
F: include/linux/gpio/
K: (devm_)?gpio_(request|free|direction|get|set)
K: GPIOD_FLAGS_BIT_NONEXCLUSIVE
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 223889c03186..fdbe2bd87979 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -48,7 +48,7 @@
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/gpio/machine.h>
#include <linux/leds.h>
#include <asm/io.h>
diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mach-rsk/devices-rsk7203.c
index e6b05d4588b7..eb56b57812bd 100644
--- a/arch/sh/boards/mach-rsk/devices-rsk7203.c
+++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c
@@ -10,7 +10,7 @@
#include <linux/interrupt.h>
#include <linux/smsc911x.h>
#include <linux/input.h>
-#include <linux/gpio.h>
+#include <linux/gpio/legacy.h>
#include <linux/gpio_keys.h>
#include <linux/leds.h>
#include <asm/machvec.h>
diff --git a/drivers/gpio/TODO b/drivers/gpio/TODO
index 7ce80fde1f17..4fce4a7e4704 100644
--- a/drivers/gpio/TODO
+++ b/drivers/gpio/TODO
@@ -52,9 +52,7 @@ Work items:
base can be made dynamic (set to -1) if CONFIG_GPIO_SYSFS is disabled.
- When this work is complete (will require some of the items in the
- following ongoing work as well) we can delete the old global
- numberspace accessors from <linux/gpio.h> and eventually delete
- <linux/gpio.h> altogether.
+ following ongoing work as well) we can delete <linux/gpio/legacy.h>.
-------------------------------------------------------------------------------
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index 9f3b628d5793..1c2c94387b77 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -11,7 +11,7 @@
#include <linux/device.h>
#include <linux/err.h>
#include <linux/file.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/hte.h>
#include <linux/interrupt.h>
diff --git a/drivers/gpio/gpiolib-legacy.c b/drivers/gpio/gpiolib-legacy.c
index ef3f2ef30cf2..33e5a45e720b 100644
--- a/drivers/gpio/gpiolib-legacy.c
+++ b/drivers/gpio/gpiolib-legacy.c
@@ -7,8 +7,7 @@
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
-
-#include <linux/gpio.h>
+#include <linux/gpio/legacy.h>
#include "gpiolib.h"
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index ef8ccaf17c9c..c9c517488e0a 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -29,7 +29,7 @@
#include <linux/string.h>
#include <linux/string_choices.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
diff --git a/drivers/net/wireless/morsemicro/mm81x/hw.c b/drivers/net/wireless/morsemicro/mm81x/hw.c
index 9293f4094db1..e48eaf151faa 100644
--- a/drivers/net/wireless/morsemicro/mm81x/hw.c
+++ b/drivers/net/wireless/morsemicro/mm81x/hw.c
@@ -7,7 +7,6 @@
#include <linux/stringify.h>
#include <linux/types.h>
#include <linux/unaligned.h>
-#include <linux/gpio.h>
#include "hif.h"
#include "mac.h"
#include "bus.h"
diff --git a/drivers/net/wireless/morsemicro/mm81x/yaps.c b/drivers/net/wireless/morsemicro/mm81x/yaps.c
index e98a2a58726f..252116425bc3 100644
--- a/drivers/net/wireless/morsemicro/mm81x/yaps.c
+++ b/drivers/net/wireless/morsemicro/mm81x/yaps.c
@@ -2,7 +2,6 @@
/*
* Copyright (c) 2017-2026 Morse Micro
*/
-#include <linux/gpio.h>
#include <linux/random.h>
#include <linux/timer.h>
#include <linux/bitops.h>
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
deleted file mode 100644
index b0d4942a65de..000000000000
--- a/include/linux/gpio.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * NOTE: This header *must not* be included.
- *
- * If you're implementing a GPIO driver, only include <linux/gpio/driver.h>
- * If you're implementing a GPIO consumer, only include <linux/gpio/consumer.h>
- * If you're using the legacy interfaces, include <linux/gpio/legacy.h>
- */
-
-#ifndef __LINUX_GPIO_H
-#define __LINUX_GPIO_H
-
-#include <linux/types.h>
-#ifdef CONFIG_GPIOLIB
-#include <linux/gpio/consumer.h>
-#endif
-
-#ifdef CONFIG_GPIOLIB_LEGACY
-#include <linux/gpio/legacy.h>
-#endif /* CONFIG_GPIOLIB_LEGACY */
-
-#endif /* __LINUX_GPIO_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread