Re: [PATCH] gpiolib: enable CONFIG_GPIOLIB_LEGACY even for !GPIOLIB

From: Geert Uytterhoeven
Date: Tue Jul 29 2025 - 08:12:50 EST


Hi Arnd,

On Tue, 29 Jul 2025 at 13:58, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> On Tue, Jul 29, 2025, at 12:47, Geert Uytterhoeven wrote:
> >>
> >> -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/

> 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

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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