From: Ahmad Fatoum Date: Wed, 7 May 2025 17:28:01 +0000 (+0200) Subject: gpio: TODO: add item about GPIO drivers reading struct gpio_chip::base X-Git-Tag: v6.16-rc1~169^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=833c086f22ecebe576af42051733796d1690dd71;p=thirdparty%2Fkernel%2Fstable.git gpio: TODO: add item about GPIO drivers reading struct gpio_chip::base drivers/pinctrl/pinctrl-at91.c uses struct gpio_chip::base to find out which bit to set in a register: dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset); mask = 1 << (offset - chip->base); This adds a non-obvious dependency on the global numberspace from the GPIO driver itself, even if all consumers use the descriptor API. More such instances may exist and will need to be fixed in the quest for removal of the global numberspace, so add a reminder about it to the TODO list. Link: https://lore.kernel.org/all/1d00c056-3d61-4c22-bedd-3bae0bf1ddc4@pengutronix.de/ Suggested-by: Bartosz Golaszewski Signed-off-by: Ahmad Fatoum Link: https://lore.kernel.org/r/20250507-gpio-chip-base-readback-v1-1-ade56e38480b@pengutronix.de Signed-off-by: Bartosz Golaszewski --- diff --git a/drivers/gpio/TODO b/drivers/gpio/TODO index b5f0a7a2e1bf1..c1f4c63a76050 100644 --- a/drivers/gpio/TODO +++ b/drivers/gpio/TODO @@ -44,6 +44,13 @@ Work items: to a machine description such as device tree, ACPI or fwnode that implicitly does not use global GPIO numbers. +- Fix drivers to not read back struct gpio_chip::base. Some drivers do + that and would be broken by attempts to poison it or make it dynamic. + Example in AT91 pinctrl driver: + https://lore.kernel.org/all/1d00c056-3d61-4c22-bedd-3bae0bf1ddc4@pengutronix.de/ + This particular driver is also DT-only, so with the above fixed, the + base can be made dynamic (set to -1) if CONFIG_GPIO_SYSFS is disabled. + - When this work is complete (will require some of the items in the following ongoing work as well) we can delete the old global numberspace accessors from and eventually delete