From 803e822b0089211367d8d368a163b1dea077159d Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 11 Mar 2026 10:42:14 +0100 Subject: [PATCH] gpiolib: Update gpiochip_find_base_unlocked() kerneldoc This function albeit static was lacking a kerneldoc, and the function returns a dangerous number for internal use so make that clear in the kerneldoc. Reported-by: Matthijs Kooijman Signed-off-by: Linus Walleij Link: https://patch.msgid.link/20260311-gpio-discourage-dynamic-v1-1-c8b68fc84203@kernel.org Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpiolib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 56fda7891d55..e287ab0d21fc 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -338,7 +338,15 @@ struct gpio_chip *gpio_device_get_chip(struct gpio_device *gdev) } EXPORT_SYMBOL_GPL(gpio_device_get_chip); -/* dynamic allocation of GPIOs, e.g. on a hotplugged device */ +/** + * gpiochip_find_base_unlocked() - Find a global GPIO number base + * @ngpio: Number of consecutive GPIOs to number + * + * Finds and allocates a consecutive range of unsigned integers representing + * the GPIOs on the system. Using this numberspace outside of gpiolibs + * internals is STRONGLY DISCOURAGED, drivers and consumers should NOT concern + * themselves with this numberspace. + */ static int gpiochip_find_base_unlocked(u16 ngpio) { unsigned int base = GPIO_DYNAMIC_BASE;