Skip to content

Commit 833c086

Browse files
a3fBartosz Golaszewski
authored andcommitted
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 <bartosz.golaszewski@linaro.org> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.kernel.org/r/20250507-gpio-chip-base-readback-v1-1-ade56e38480b@pengutronix.de Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 0a45c1a commit 833c086

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/gpio/TODO

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ Work items:
4444
to a machine description such as device tree, ACPI or fwnode that
4545
implicitly does not use global GPIO numbers.
4646

47+
- Fix drivers to not read back struct gpio_chip::base. Some drivers do
48+
that and would be broken by attempts to poison it or make it dynamic.
49+
Example in AT91 pinctrl driver:
50+
https://lore.kernel.org/all/1d00c056-3d61-4c22-bedd-3bae0bf1ddc4@pengutronix.de/
51+
This particular driver is also DT-only, so with the above fixed, the
52+
base can be made dynamic (set to -1) if CONFIG_GPIO_SYSFS is disabled.
53+
4754
- When this work is complete (will require some of the items in the
4855
following ongoing work as well) we can delete the old global
4956
numberspace accessors from <linux/gpio.h> and eventually delete

0 commit comments

Comments
 (0)