[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250519041850.13095-1-chalianis1@gmail.com>
Date: Mon, 19 May 2025 00:18:50 -0400
From: chalianis1@...il.com
To: linus.walleij@...aro.org,
brgl@...ev.pl
Cc: linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org,
Anis Chali <chalianis1@...il.com>
Subject: [PATCH] gpiochip: expose gpiochip set data to be able to use it with a an usb gpio expander for example.
From: Anis Chali <chalianis1@...il.com>
Signed-off-by: Anis Chali <chalianis1@...il.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
Powered by blists - more mailing lists