gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB
PATCH 1/1 gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB
From: Arnd Bergmann <[email protected]>
A few drivers that use the legacy GPIOLIB interfaces can be enabled even when GPIOLIB is disabled entirely. With my previous patch this now causes build failures like:
drivers/nfc/s3fwrn5/uart.c: In function 's3fwrn82_uart_parse_dt':
drivers/nfc/s3fwrn5/uart.c:100:14: error: implicit declaration of function 'gpio_is_valid'; did you mean 'uuid_is_valid'? [-Werror=implicit-function-declaration]
These did not show up in my randconfig tests because randconfig almost always has GPIOLIB selected by some other driver, and I did most of the testing with follow-up patches that address the failures properly.
Move the symbol outside of the 'if CONFIG_GPIOLIB' block for the moment to avoid the build failures. It can be moved back and turned off by default once all the driver specific changes are merged.
--- drivers/gpio/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/Kconfig +2 -2
@@ -12,11 +12,11 @@ menuconfig GPIOLIB If unsure, say N. -if GPIOLIB - config GPIOLIB_LEGACY def_bool y +if GPIOLIB + config GPIOLIB_FASTPATH_LIMIT int "Maximum number of GPIOs for fast path" range 32 512
Signature · 1 line
2.39.5
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 8 lines · Arnd Bergmann
A few drivers that use the legacy GPIOLIB interfaces can be enabled even when GPIOLIB is disabled entirely. With my previous patch this now causes build failures like:
drivers/nfc/s3fwrn5/uart.c: In function 's3fwrn82_uart_parse_dt':
drivers/nfc/s3fwrn5/uart.c:100:14: error: implicit declaration of function 'gpio_is_valid'; did you mean 'uuid_is_valid'? [-Werror=implicit-function-declaration][...]
Applied, thanks!
[1/1] gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB
https://git.kernel.org/brgl/linux/c/a86240a37d43fc22b4e4953242fca8d90df2c555
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>
Hi Arnd,
Quoted 14 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
A few drivers that use the legacy GPIOLIB interfaces can be enabled even when GPIOLIB is disabled entirely. With my previous patch this now causes build failures like:
drivers/nfc/s3fwrn5/uart.c: In function 's3fwrn82_uart_parse_dt':
drivers/nfc/s3fwrn5/uart.c:100:14: error: implicit declaration of function 'gpio_is_valid'; did you mean 'uuid_is_valid'? [-Werror=implicit-function-declaration]These did not show up in my randconfig tests because randconfig almost always has GPIOLIB selected by some other driver, and I did most of the testing with follow-up patches that address the failures properly.
Quoted 8 lines
Move the symbol outside of the 'if
CONFIG_GPIOLIB' block for the moment to avoid the build failures. It can be moved back and turned off by default once all the driver specific changes are merged.Reported-by kernel test robot <[email protected]>Fixes 678bae2eaa81 ("gpiolib: make legacy interfaces optional")Signed-off-by Arnd Bergmann <[email protected]>
Thanks for your patch, which is now commit a86240a37d43fc22 ("gpiolib:
enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB") in linus/master
Quoted 6 lines
drivers/gpio/Kconfig +0
-0@@ -12,11 +12,11 @@ menuconfig GPIOLIB If unsure, say N.
drivers/gpio/Kconfig menuconfig GPIOLIB · line 22
Quoted 10 lines
drivers/gpio/Kconfig +2
-2-if GPIOLIB - config GPIOLIB_LEGACY def_bool y +if GPIOLIB + config GPIOLIB_FASTPATH_LIMIT int "Maximum number of GPIOs for fast path" range 32 512
This won't work for everything.
While I now get CONFIG_GPIOLIB_LEGACY=y in all m68k defconfigs, and simple inline functions like gpio_is_valid() are now available, more complex functions will still fail, as drivers/gpio/gpiolib-legacy.c is not built.
drivers/Makefile:
obj-$(CONFIG_GPIOLIB) += gpio/
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 18 lines · Geert Uytterhoeven
drivers/gpio/Kconfig menuconfig GPIOLIB · line 22
Quoted 11 lines
drivers/gpio/Kconfig +2
-2-if GPIOLIB - config GPIOLIB_LEGACY def_bool y +if GPIOLIB + config GPIOLIB_FASTPATH_LIMIT int "Maximum number of GPIOs for fast path" range 32 512This won't work for everything.
While I now getCONFIG_GPIOLIB_LEGACY=yin all m68k defconfigs, and simple inline functions likegpio_is_valid()are now available, more complex functions will still fail, asdrivers/gpio/gpiolib-legacy.cis not built.
Quoted 4 lines
drivers/Makefile:obj-$(CONFIG_GPIOLIB) += gpio/
Hi Geert,
Do you have an example config that shows this problem? I've tried a couple of configurations on m68k now but are unable to reproduce this, using 'defconfig' (without GPIOLIB) and 'm5475evb_defconfig' (with GPIOLIB).
The intention of this patch (in combination with the previous one) was that the legacy interfaces would still behave exactly like before, falling back to the stubs when GPIOLIB is disabled.
Arnd
Hi Arnd,
Quoted 23 lines · Arnd Bergmann
Quoted 18 lines · Geert Uytterhoeven
drivers/gpio/Kconfig menuconfig GPIOLIB · line 22
Quoted 11 lines
drivers/gpio/Kconfig +2
-2-if GPIOLIB - config GPIOLIB_LEGACY def_bool y +if GPIOLIB + config GPIOLIB_FASTPATH_LIMIT int "Maximum number of GPIOs for fast path" range 32 512This won't work for everything.
While I now getCONFIG_GPIOLIB_LEGACY=yin all m68k defconfigs, and simple inline functions likegpio_is_valid()are now available, more complex functions will still fail, asdrivers/gpio/gpiolib-legacy.cis not built.Quoted 3 lines
drivers/Makefile:obj-$(CONFIG_GPIOLIB) += gpio/
Quoted 8 lines
Do you have an example config that shows this problem? I've tried a couple of configurations on m68k now but are unable to reproduce this, using 'defconfig' (without GPIOLIB) and '
m5475evb_defconfig' (with GPIOLIB).The intention of this patch (in combination with the previous one) was that the legacy interfaces would still behave exactly like before, falling back to the stubs when GPIOLIB is disabled.
I haven't seen any actual failures. When discovering CONFIG_GPIOLIB_LEGACY=y in all m68k defconfigs, my initial worry was that it would increase kernel size by needlessly including gpiolib-legacy.o. When that didn't turn out to be true, I started wondering how your commit would fix anything without including gpiolib-legacy.o. Looks like any users just uses the simple static inlines...
Sorry for confusing you.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 11 lines · Geert Uytterhoeven
Quoted 9 lines · Arnd Bergmann
On Tue, Jul 29, 2025, at 12:47, Geert Uytterhoeven wrote:
Do you have an example config that shows this problem? I've tried a couple of configurations on m68k now but are unable to reproduce this, using 'defconfig' (without GPIOLIB) and 'm5475evb_defconfig' (with GPIOLIB).The intention of this patch (in combination with the previous one) was that the legacy interfaces would still behave exactly like before, falling back to the stubs when GPIOLIB is disabled.
Quoted 8 lines
I haven't seen any actual failures. When discovering
CONFIG_GPIOLIB_LEGACY=yin all m68k defconfigs, my initial worry was that it would increase kernel size by needlessly including gpiolib-legacy.o. When that didn't turn out to be true, I started wondering how your commit would fix anything without including gpiolib-legacy.o. Looks like any users just uses the simple static inlines...
Sorry for confusing you.
No worries, thanks for paying attention to incoming changes!
If you want to see what the actual plan is, have a look at
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=config-gpio-legacy
which ends with making GPIOLIB_LEGACY actually optional.
Any driver that actually uses the legacy gpiolib interfaces at that point is already specific to one of the few platforms that still have legacy gpiochips (sh, sa1100, pxa, s3c64xx, orion5x, mv78xx0, coldfire, alchemy, txx9, bcm47xx, bcm63xx, rb532, olpc, and a few x86 atom boards), or it has an explicit dependency on GPIOLIB_LEGACY.
The arm boards are already on their way out, but the others could probably use some help converting to gpio descriptors.
Arnd
Quoted 18 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
A few drivers that use the legacy GPIOLIB interfaces can be enabled even when GPIOLIB is disabled entirely. With my previous patch this now causes build failures like:
drivers/nfc/s3fwrn5/uart.c: In function 's3fwrn82_uart_parse_dt':
drivers/nfc/s3fwrn5/uart.c:100:14: error: implicit declaration of function 'gpio_is_valid'; did you mean 'uuid_is_valid'? [-Werror=implicit-function-declaration]These did not show up in my randconfig tests because randconfig almost always has GPIOLIB selected by some other driver, and I did most of the testing with follow-up patches that address the failures properly.
Move the symbol outside of the 'if
CONFIG_GPIOLIB' block for the moment to avoid the build failures. It can be moved back and turned off by default once all the driver specific changes are merged.
Quoted 7 lines
Reported-by kernel test robot <[email protected]>Fixes 678bae2eaa81 ("gpiolib: make legacy interfaces optional")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/gpio/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
This change causes all of the GPIO submenu to show up directly in the already way too long 'Device Drivers' menu.
drivers/gpio/Kconfig menuconfig GPIOLIB · line 16
Quoted 13 lines
drivers/gpio/Kconfig +0
-2@@ -12,11 +12,11 @@ menuconfig GPIOLIB If unsure, say N. -if GPIOLIB - config GPIOLIB_LEGACY def_bool y
Perhaps this has to be before "menuconfig GPIOLIB"?
Quoted 9 lines
drivers/gpio/Kconfig +2
-0+if GPIOLIB + config GPIOLIB_FASTPATH_LIMIT int "Maximum number of GPIOs for fast path" range 32 512Signature · 1 line
2.39.5
Quoted 38 lines · Rob Herring
Quoted 18 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
A few drivers that use the legacy GPIOLIB interfaces can be enabled even when GPIOLIB is disabled entirely. With my previous patch this now causes build failures like:
drivers/nfc/s3fwrn5/uart.c: In function 's3fwrn82_uart_parse_dt':
drivers/nfc/s3fwrn5/uart.c:100:14: error: implicit declaration of function 'gpio_is_valid'; did you mean 'uuid_is_valid'? [-Werror=implicit-function-declaration]These did not show up in my randconfig tests because randconfig almost always has GPIOLIB selected by some other driver, and I did most of the testing with follow-up patches that address the failures properly.
Move the symbol outside of the 'if
CONFIG_GPIOLIB' block for the moment to avoid the build failures. It can be moved back and turned off by default once all the driver specific changes are merged.Quoted 7 lines
Reported-by kernel test robot <[email protected]>Fixes 678bae2eaa81 ("gpiolib: make legacy interfaces optional")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/gpio/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)This change causes all of the GPIO submenu to show up directly in the already way too long 'Device Drivers' menu.
Quoted 7 lines
drivers/gpio/Kconfig +0
-0@@ -12,11 +12,11 @@ menuconfig GPIOLIB
Quoted 9 lines
drivers/gpio/Kconfig menuconfig GPIOLIB · line 16
Quoted 6 lines
drivers/gpio/Kconfig +0
-2If unsure, say N. -if GPIOLIB - config GPIOLIB_LEGACY def_bool yPerhaps this has to be before "menuconfig GPIOLIB"?
Hi Arnd,
This is still broken in next, will you have some time to spend on it or should I just go with what Rob proposed?
Bart
Quoted 9 lines
Quoted 9 lines
drivers/gpio/Kconfig +2
-1+if GPIOLIB + config GPIOLIB_FASTPATH_LIMIT int "Maximum number of GPIOs for fast path" range 32 512 --2.39.5