gpiolib: finish the legacy cleanup
Subsystems (6)
v8 cover gpiolib: finish the legacy cleanup
From: Arnd Bergmann <[email protected]>
These two patches are left from my cleanup series, finishing off the work to turn off CONFIG_GPIOLIB_LEGACY by default, and removing the include/linux/gpio.h header.
This was planned for 7.3 originally[1], but kept conflicting with ongoing cleanups for the broken rsk7203 board. I've skipped the oneline rsk change now, which will be fixed properly by Dmitry's patch [2].
Arnd
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Arnd Bergmann (2):
[v8] gpiolib: turn off legacy interface by default [v8] gpiolib: remove linux/gpio.h
MAINTAINERS | 1 - arch/mips/txx9/rbtx4927/setup.c | 2 +- drivers/gpio/Kconfig | 9 +++++++- 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, 13 insertions(+), 34 deletions(-) delete mode 100644 include/linux/gpio.h
Signature · 14 lines
2.53.0 Cc: Bartosz Golaszewski <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Johannes Berg <[email protected]> Cc: John Paul Adrian Glaubitz <[email protected]> Cc: Kent Gibson <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
PATCH v8 1/2 gpiolib: turn off legacy interface by default
From: Arnd Bergmann <[email protected]>
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.
--- drivers/gpio/Kconfig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpio/Kconfig +8 -1
@@ -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
Signature · 1 line
2.53.0
PATCH v8 2/2 gpiolib: remove linux/gpio.h
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
After all other drivers have converted to linux/gpio/consumer.h or linux/gpio/legacy.h, remove the final leftover bits here.
--- MAINTAINERS | 1 - arch/mips/txx9/rbtx4927/setup.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 -------------------- 9 files changed, 5 insertions(+), 33 deletions(-) delete mode 100644 include/linux/gpio.h
MAINTAINERS +0 -1
@@ -11589,7 +11589,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
arch/mips/txx9/rbtx4927/setup.c +1 -1
@@ -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>
drivers/gpio/TODO +1 -3
@@ -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>. -------------------------------------------------------------------------------
drivers/gpio/gpiolib-cdev.c +1 -1
@@ -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>
drivers/gpio/gpiolib-legacy.c +1 -2
@@ -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"
drivers/gpio/gpiolib.c +1 -1
@@ -30,7 +30,7 @@#include <linux/string_choices.h> #include <linux/workqueue.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/gpio/driver.h> #include <linux/gpio/machine.h>
drivers/net/wireless/morsemicro/mm81x/hw.c +0 -1
@@ -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"
drivers/net/wireless/morsemicro/mm81x/yaps.c +0 -1
@@ -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>
include/linux/gpio.h deleted +0 -22
@@ -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 */
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 2/2] [v8] gpiolib: remove linux/gpio.h
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] gpiolib: build failure in rsk7203_devices_setup() after removing linux/gpio.h --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] gpiolib: build failure in rsk7203_devices_setup() after removing linux/gpio.h
--
commit 29b33c0e6261ed7e945f5222da273adda4c798f3
Author: Arnd Bergmann <[email protected]>
gpiolib: remove linux/gpio.h
This commit removes the remaining includes of <linux/gpio.h> in gpiolib, rbtx4927, and mm81x, and deletes include/linux/gpio.h.
Quoted 18 lines
include/linux/gpio.h deleted +0
-12@@ -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/gpio.h line 22
Quoted 10 lines
include/linux/gpio.h deleted +0
-10-#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 */
[Severity: High]
Does removing include/linux/gpio.h break the build for arch/sh/boards/mach-rsk/devices-rsk7203.c (CONFIG_SH_RSK7203)?
That file still includes <linux/gpio.h>, which now resolves to include/uapi/linux/gpio.h without pulling in <linux/gpio/legacy.h>, leaving gpio_request() undeclared in rsk7203_devices_setup():
arch/sh/boards/mach-rsk/devices-rsk7203.c:rsk7203_devices_setup() {
...
/* Select pins for SCIF0 */
gpio_request(GPIO_FN_TXD0, NULL);
gpio_request(GPIO_FN_RXD0, NULL);
...
}Should arch/sh/boards/mach-rsk/devices-rsk7203.c be updated to include <linux/gpio/legacy.h>?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Bartosz Golaszewski
maintainerQuoted 10 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
These two patches are left from my cleanup series, finishing off the work to turn off
CONFIG_GPIOLIB_LEGACYby default, and removing theinclude/linux/gpio.hheader.This was planned for 7.3 originally[1], but kept conflicting with ongoing cleanups for the broken rsk7203 board. I've skipped the oneline rsk change now, which will be fixed properly by Dmitry's patch [2].
What is the base commit? It doesn't apply on top of linux-next.
Bart
Bartosz Golaszewski
maintainerQuoted 7 lines · Bartosz Golaszewski
Quoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
These two patches are left from my cleanup series, finishing off the work to turn off
CONFIG_GPIOLIB_LEGACYby default, and removing theinclude/linux/gpio.hheader.
Quoted 7 lines
Quoted 4 lines
This was planned for 7.3 originally[1], but kept conflicting with ongoing cleanups for the broken rsk7203 board. I've skipped the oneline rsk change now, which will be fixed properly by Dmitry's patch [2].
What is the base commit? It doesn't apply on top of linux-next.
Scratch that, PEBKAC.
Sashiko is right:
CC arch/sh/boards/mach-rsk/devices-rsk7203.oarch/sh/boards/mach-rsk/devices-rsk7203.c: In function ‘rsk7203_devices_setup’:arch/sh/boards/mach-rsk/devices-rsk7203.c:127:9: error: implicit declaration of function ‘gpio_request’; did you mean ‘symbol_request’? [-Wimplicit-function-declaration]
127 | gpio_request(GPIO_FN_TXD0, NULL);
| ^~~~~~~~~~~~
| symbol_requestmake[5]: *** [scripts/Makefile.build:321: arch/sh/boards/mach-rsk/devices-rsk7203.o] Error 1 make[4]: *** [scripts/Makefile.build:606: arch/sh/boards/mach-rsk] Error 2 make[3]: *** [scripts/Makefile.build:606: arch/sh/boards] Error 2
make[2]: *** [scripts/Makefile.build:606: arch/sh] Error 2
make[1]: *** [/home/brgl/workspace/linux/Makefile:2257: .] Error 2
Bart
Quoted 16 lines · Bartosz Golaszewski
Quoted 7 lines · Bartosz Golaszewski
Quoted 5 lines · Arnd Bergmann
This was planned for 7.3 originally[1], but kept conflicting with ongoing cleanups for the broken rsk7203 board. I've skipped the oneline rsk change now, which will be fixed properly by Dmitry's patch [2].
Sashiko is right:
CC
arch/sh/boards/mach-rsk/devices-rsk7203.oarch/sh/boards/mach-rsk/devices-rsk7203.c: In function ‘rsk7203_devices_setup’:arch/sh/boards/mach-rsk/devices-rsk7203.c:127:9: error: implicit declaration of function ‘gpio_request’; did you mean ‘symbol_request’? [-Wimplicit-function-declaration]
Quoted 3 lines
127 | gpio_request(GPIO_FN_TXD0, NULL);
| ^~~~~~~~~~~~
| symbol_requestYes, this just seemed the easiest way out to avoid clashing with Dmitry's patches again. If you want the version that doesn't break the build, you can still apply v7 [1], but that likely means his series has go through another revision to undo my change and remove the linux/gpio/legacy.h inclusion.
Arnd
Bartosz Golaszewski
maintainerQuoted 21 lines · Arnd Bergmann
Quoted 16 lines · Bartosz Golaszewski
Quoted 7 lines · Bartosz Golaszewski
Quoted 5 lines · Arnd Bergmann
This was planned for 7.3 originally[1], but kept conflicting with ongoing cleanups for the broken rsk7203 board. I've skipped the oneline rsk change now, which will be fixed properly by Dmitry's patch [2].
Sashiko is right:
CC
arch/sh/boards/mach-rsk/devices-rsk7203.oarch/sh/boards/mach-rsk/devices-rsk7203.c: In function ‘rsk7203_devices_setup’:arch/sh/boards/mach-rsk/devices-rsk7203.c:127:9: error: implicit declaration of function ‘gpio_request’; did you mean ‘symbol_request’? [-Wimplicit-function-declaration]Quoted 3 lines
127 | gpio_request(GPIO_FN_TXD0, NULL); | ^~~~~~~~~~~~ | symbol_request
Quoted 6 lines
Yes, this just seemed the easiest way out to avoid clashing with Dmitry's patches again. If you want the version that doesn't break the build, you can still apply v7 [1], but that likely means his series has go through another revision to undo my change and remove the
linux/gpio/legacy.hinclusion.
Can I apply v7 and provide it to the SH maintainers on an immutable branch?
Bart