[PATCH] Allow configuration of ARCH_NR_GPIO

Arnd Bergmann arnd at arndb.de
Sat Jul 30 04:54:18 PDT 2022


On Sat, Jul 30, 2022 at 2:38 AM Billie Alsup <balsup at cisco.com> wrote:
>
> From: Billie R Alsup <balsup at cisco.com>
>
> Problem: Some systems support a high number of GPIO pins.  Allow
> the kernel builder to configure the maximum number of pins, rather
> than forcing a large value on everyone.
>
> Impact: Once a .config is generated, the ARCH_NR_GPIO setting
> will persist.  To return to a default setting, the CONFIG_ARCH_NR_GPIO
> must be removed from .config file first.
>
> Trade-offs: It is possible to achieve similar via command line
> parameters, e.g.
>
>     make KBUILD_CFLAGS_KERNEL=-DARCH_NR_GPIOS=16384
>
> to the build. This is problematic because the setting does not
> show up in /proc/config.gz.  It is also problematic for out-of-tree
> module builds, which require similar if they invoke the API
> gpio_is_valid().  In both cases, one could envision one system
> working normally, and another failing, even though they both have
> the same kernel version and /proc/config.gz.  Therefore, it is
> better to have the setting available in .config
>
> Signed-off-by: Billie R Alsup <balsup at cisco.com>

What is the use case for manually setting this rather than deriving
it from the selected platforms?

Have you tried to use both a platform-specific option for the minimum
number of this setting, and then restictricting the CONFIG_ARCH_NR_GPIO
setting with a 'range' statement?

         Arnd



More information about the linux-arm-kernel mailing list