mbox series

[v1,0/8] gpio: Get rid of ARCH_NR_GPIOS (v1)

Message ID cover.1661789204.git.christophe.leroy@csgroup.eu
Headers show
Series gpio: Get rid of ARCH_NR_GPIOS (v1) | expand

Message

Christophe Leroy Aug. 29, 2022, 4:15 p.m. UTC
Since commit 14e85c0e69d5 ("gpio: remove gpio_descs global array")
there is no limitation on the number of GPIOs that can be allocated
in the system since the allocation is fully dynamic.

ARCH_NR_GPIOS is today only used in order to provide downwards
gpiobase allocation from that value, while static allocation is
performed upwards from 0. However that has the disadvantage of
limiting the number of GPIOs that can be registered in the system.

To overcome this limitation without requiring each and every
platform to provide its 'best-guess' maximum number, rework the
allocation to allocate from 256 upwards, allowing approx 2 millions
of GPIOs.

In the meantime, add a warning for drivers how are still doing
static allocation, so that in the future the static allocation gets
removed completely and dynamic allocation can start at base 0.

Christophe Leroy (8):
  gpio: aggregator: Stop using ARCH_NR_GPIOS
  gpio: davinci: Stop using ARCH_NR_GPIOS
  gpiolib: Warn on drivers still using static gpiobase allocation
  gpiolib: Get rid of ARCH_NR_GPIOS
  Documentation: gpio: Remove text about ARCH_NR_GPIOS
  x86: Remove CONFIG_ARCH_NR_GPIO
  arm: Remove CONFIG_ARCH_NR_GPIO
  arm64: Remove CONFIG_ARCH_NR_GPIO

 Documentation/driver-api/gpio/legacy.rst |  5 ---
 arch/arm/Kconfig                         | 21 ---------
 arch/arm/include/asm/gpio.h              |  1 -
 arch/arm64/Kconfig                       | 12 ------
 arch/x86/Kconfig                         |  5 ---
 drivers/gpio/gpio-aggregator.c           |  8 ++--
 drivers/gpio/gpio-davinci.c              |  3 --
 drivers/gpio/gpio-sta2x11.c              |  5 +--
 drivers/gpio/gpiolib.c                   | 13 +++---
 include/asm-generic/gpio.h               | 55 +++++++++---------------
 10 files changed, 36 insertions(+), 92 deletions(-)

Comments

Andy Shevchenko Aug. 30, 2022, 8:20 p.m. UTC | #1
On Mon, Aug 29, 2022 at 7:17 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
> Since commit 14e85c0e69d5 ("gpio: remove gpio_descs global array")
> there is no limitation on the number of GPIOs that can be allocated
> in the system since the allocation is fully dynamic.
>
> ARCH_NR_GPIOS is today only used in order to provide downwards
> gpiobase allocation from that value, while static allocation is
> performed upwards from 0. However that has the disadvantage of
> limiting the number of GPIOs that can be registered in the system.
>
> To overcome this limitation without requiring each and every
> platform to provide its 'best-guess' maximum number, rework the
> allocation to allocate from 256 upwards, allowing approx 2 millions
> of GPIOs.
>
> In the meantime, add a warning for drivers how are still doing
> static allocation, so that in the future the static allocation gets
> removed completely and dynamic allocation can start at base 0.

For non-commented (by me or others) patches
Reviewed-by: Andy Shevchenko <andy.shevchenko!gmail.com>
For the patch 1 if you are going to address as suggested by the author
of the driver, you may also add my tag.

> Christophe Leroy (8):
>   gpio: aggregator: Stop using ARCH_NR_GPIOS
>   gpio: davinci: Stop using ARCH_NR_GPIOS
>   gpiolib: Warn on drivers still using static gpiobase allocation
>   gpiolib: Get rid of ARCH_NR_GPIOS
>   Documentation: gpio: Remove text about ARCH_NR_GPIOS
>   x86: Remove CONFIG_ARCH_NR_GPIO
>   arm: Remove CONFIG_ARCH_NR_GPIO
>   arm64: Remove CONFIG_ARCH_NR_GPIO
>
>  Documentation/driver-api/gpio/legacy.rst |  5 ---
>  arch/arm/Kconfig                         | 21 ---------
>  arch/arm/include/asm/gpio.h              |  1 -
>  arch/arm64/Kconfig                       | 12 ------
>  arch/x86/Kconfig                         |  5 ---
>  drivers/gpio/gpio-aggregator.c           |  8 ++--
>  drivers/gpio/gpio-davinci.c              |  3 --
>  drivers/gpio/gpio-sta2x11.c              |  5 +--
>  drivers/gpio/gpiolib.c                   | 13 +++---
>  include/asm-generic/gpio.h               | 55 +++++++++---------------
>  10 files changed, 36 insertions(+), 92 deletions(-)
>
> --
> 2.37.1
>
Andy Shevchenko Aug. 30, 2022, 8:21 p.m. UTC | #2
On Tue, Aug 30, 2022 at 11:20 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Mon, Aug 29, 2022 at 7:17 PM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
> >
> > Since commit 14e85c0e69d5 ("gpio: remove gpio_descs global array")
> > there is no limitation on the number of GPIOs that can be allocated
> > in the system since the allocation is fully dynamic.
> >
> > ARCH_NR_GPIOS is today only used in order to provide downwards
> > gpiobase allocation from that value, while static allocation is
> > performed upwards from 0. However that has the disadvantage of
> > limiting the number of GPIOs that can be registered in the system.
> >
> > To overcome this limitation without requiring each and every
> > platform to provide its 'best-guess' maximum number, rework the
> > allocation to allocate from 256 upwards, allowing approx 2 millions
> > of GPIOs.
> >
> > In the meantime, add a warning for drivers how are still doing
> > static allocation, so that in the future the static allocation gets
> > removed completely and dynamic allocation can start at base 0.
>
> For non-commented (by me or others) patches
> Reviewed-by: Andy Shevchenko <andy.shevchenko!gmail.com>

Should be
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> For the patch 1 if you are going to address as suggested by the author
> of the driver, you may also add my tag.