[PATCH] gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB

Arnd Bergmann posted 1 patch 2 months, 1 week ago
drivers/gpio/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB
Posted by Arnd Bergmann 2 months, 1 week ago
From: Arnd Bergmann <arnd@arndb.de>

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.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202507261934.yIHeUuEQ-lkp@intel.com/
Fixes: 678bae2eaa81 ("gpiolib: make legacy interfaces optional")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpio/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 8bda3c9d47b4..c48f9badb513 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -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
-- 
2.39.5
Re: [PATCH] gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB
Posted by Rob Herring 1 month, 3 weeks ago
On Sat, Jul 26, 2025 at 11:10:43PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202507261934.yIHeUuEQ-lkp@intel.com/
> Fixes: 678bae2eaa81 ("gpiolib: make legacy interfaces optional")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  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.

> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 8bda3c9d47b4..c48f9badb513 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -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"?

>  
> +if GPIOLIB
> +
>  config GPIOLIB_FASTPATH_LIMIT
>  	int "Maximum number of GPIOs for fast path"
>  	range 32 512
> -- 
> 2.39.5
>
Re: [PATCH] gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB
Posted by Bartosz Golaszewski 1 month ago
On Thu, Aug 14, 2025 at 12:26 AM Rob Herring <robh@kernel.org> wrote:
>
> On Sat, Jul 26, 2025 at 11:10:43PM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > 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.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202507261934.yIHeUuEQ-lkp@intel.com/
> > Fixes: 678bae2eaa81 ("gpiolib: make legacy interfaces optional")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  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.
>
> >
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index 8bda3c9d47b4..c48f9badb513 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -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"?
>

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

> >
> > +if GPIOLIB
> > +
> >  config GPIOLIB_FASTPATH_LIMIT
> >       int "Maximum number of GPIOs for fast path"
> >       range 32 512
> > --
> > 2.39.5
> >
Re: [PATCH] gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB
Posted by Geert Uytterhoeven 2 months, 1 week ago
Hi Arnd,

On Sat, 26 Jul 2025 at 23:11, Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202507261934.yIHeUuEQ-lkp@intel.com/
> Fixes: 678bae2eaa81 ("gpiolib: make legacy interfaces optional")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks for your patch, which is now commit a86240a37d43fc22 ("gpiolib:
enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB") in linus/master

> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -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

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

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
Re: [PATCH] gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB
Posted by Bartosz Golaszewski 2 months, 1 week ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Sat, 26 Jul 2025 23:10:43 +0200, Arnd Bergmann wrote:
> 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,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>