[PATCH] gpiochip: expose gpiochip set data to be able to use it with a an usb gpio expander for example.

chalianis1@gmail.com posted 1 patch 7 months ago
drivers/gpio/gpiolib.c      | 8 +++++++-
include/linux/gpio/driver.h | 3 +++
2 files changed, 10 insertions(+), 1 deletion(-)
[PATCH] gpiochip: expose gpiochip set data to be able to use it with a an usb gpio expander for example.
Posted by chalianis1@gmail.com 7 months ago
From: Anis Chali <chalianis1@gmail.com>

Signed-off-by: Anis Chali <chalianis1@gmail.com>
---
 drivers/gpio/gpiolib.c      | 8 +++++++-
 include/linux/gpio/driver.h | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index cd4fecbb41f2..58d051141f53 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -900,10 +900,16 @@ static void gpiochip_setup_devs(void)
 	}
 }
 
-static void gpiochip_set_data(struct gpio_chip *gc, void *data)
+/**
+ * gpiochip_set_data() - set per-subdriver data for the chip
+ * @gc: GPIO chip
+ * @data: Data for GPIO chip
+ */
+void gpiochip_set_data(struct gpio_chip *gc, void *data)
 {
 	gc->gpiodev->data = data;
 }
+EXPORT_SYMBOL_GPL(gpiochip_set_data);
 
 /**
  * gpiochip_get_data() - get per-subdriver data for the chip
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 4c0294a9104d..b1206fe42c26 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -717,6 +717,9 @@ const unsigned long *gpiochip_query_valid_mask(const struct gpio_chip *gc);
 /* get driver data */
 void *gpiochip_get_data(struct gpio_chip *gc);
 
+/* gpiochip set data */
+void gpiochip_set_data(struct gpio_chip *gc, void *data);
+
 struct bgpio_pdata {
 	const char *label;
 	int base;
-- 
2.49.0
Re: [PATCH] gpiochip: expose gpiochip set data to be able to use it with a an usb gpio expander for example.
Posted by Bartosz Golaszewski 7 months ago
On Mon, May 19, 2025 at 6:18 AM <chalianis1@gmail.com> wrote:
>
> From: Anis Chali <chalianis1@gmail.com>
>
> Signed-off-by: Anis Chali <chalianis1@gmail.com>
> ---

I will definitely need a more elaborate explanation of what you're
trying to do and why. We don't export symbols that have no users in
the kernel so I would at least expect a second patch adding it.

Bart