[PATCH v1 4/8] gpiolib: Get rid of ARCH_NR_GPIOS

Andy Shevchenko andy.shevchenko at gmail.com
Fri Sep 2 03:52:37 PDT 2022


(Nuno, one point below for you)

On Wed, Aug 31, 2022 at 11:55 PM Arnd Bergmann <arnd at arndb.de> wrote:

...

> drivers/gpio/gpio-adp5520.c:    gc->base = pdata->gpio_start; // unused
> drivers/gpio/gpio-adp5588.c:            gc->base = pdata->gpio_start; // unused
> drivers/input/keyboard/adp5588-keys.c:  kpad->gc.base = gpio_data->gpio_start; // unused
> drivers/input/keyboard/adp5589-keys.c:  kpad->gc.base = gpio_data->gpio_start; // unused

I believe we should convert them to -1.

> drivers/gpio/gpio-bt8xx.c:      c->base = modparam_gpiobase; // from modprobe
> drivers/gpio/gpio-ich.c:        chip->base = modparam_gpiobase; // from modprobe

I believe it was designed for Intel hardware and so it can't be higher
than 512 - ngpios, where the latter one is small enough (dozen or a
couple of dozens of pins).

> drivers/gpio/gpio-dwapb.c:      port->gc.base = pp->gpio_base; // from DT, deprecated

>From board files, since some platforms expect a fixed number for it.

> drivers/gpio/gpio-mockup.c:     gc->base = base; // module parama

This is for testing, so the test cases should be amended accordingly.
But I think the module itself is deprecated, and gpio-sim seems not
using it as a modprobe parameter, but rather as configfs.

> drivers/gpio/gpio-pca953x.c:    gc->base = chip->gpio_start; // ???? used a lot

To answer this one needs to go via all board files (most of them ARM
32-bit based) and look, but it means almost the same case as per Intel
above: 512-ngpios.

> drivers/pinctrl/renesas/gpio.c: gc->base = pfc->nr_gpio_pins; // ??? don't understand

I think, w/o looking into the code, that this just guarantees the
continuous numbering for all banks (chips) on the platform.

> drivers/pinctrl/stm32/pinctrl-stm32.c:          bank->gpio_chip.base = args.args[1];

Device Tree?!

-- 
With Best Regards,
Andy Shevchenko



More information about the linux-arm-kernel mailing list