[PATCH] gpiolib: regmap: document gpio_regmap_get_chip()

From: Long Zhao via B4 Relay

Date: Mon Sep 21 2026 - 08:49:01 EST


From: Long Zhao <longzhao@xxxxxxxxxxxxx>

Add kernel-doc for the new helper and state that it is only for GPIO
controller drivers, not for GPIO consumers.

This is a follow-up to v8 09/18.

Signed-off-by: Long Zhao <longzhao@xxxxxxxxxxxxx>
---
Follow-up to v8 09/18:
https://lore.kernel.org/r/20260921-cv75-v5-v8-9-42de52d636a0@xxxxxxxxxxxxx
Add kernel-doc for gpio_regmap_get_chip().
---
drivers/gpio/gpio-regmap.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 21e0993b89e2..8ba7263729a8 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -295,6 +295,19 @@ void *gpio_regmap_get_drvdata(struct gpio_regmap *gpio)
}
EXPORT_SYMBOL_GPL(gpio_regmap_get_drvdata);

+/**
+ * gpio_regmap_get_chip() - Return the gpio_chip of a gpio-regmap instance
+ * @gpio: Handle returned by gpio_regmap_register()
+ *
+ * GPIO controller drivers that register through gpio-regmap but still
+ * implement a custom irqchip can use this to obtain the associated
+ * gpio_chip after registration.
+ *
+ * This must not be used outside of GPIO controller driver context,
+ * for example not by GPIO consumers.
+ *
+ * Return: Pointer to the embedded struct gpio_chip.
+ */
struct gpio_chip *gpio_regmap_get_chip(struct gpio_regmap *gpio)
{
return &gpio->gpio_chip;

---
base-commit: 4b54e79ffe453959073b81638c3ac6c04177639e
change-id: 20260921-gpio-doc-followup-8289cca93b2a

Best regards,
--
Long Zhao <longzhao@xxxxxxxxxxxxx>