From: chalianis1@gmail.com
To: linus.walleij@linaro.org, brgl@bgdev.pl
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Anis Chali <chalianis1@gmail.com>
Subject: [PATCH] gpiochip: expose gpiochip set data to be able to use it with a an usb gpio expander for example.
Date: Mon, 19 May 2025 00:18:50 -0400 [thread overview]
Message-ID: <20250519041850.13095-1-chalianis1@gmail.com> (raw)
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
next reply other threads:[~2025-05-19 4:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 4:18 chalianis1 [this message]
2025-05-19 8:27 ` [PATCH] gpiochip: expose gpiochip set data to be able to use it with a an usb gpio expander for example Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250519041850.13095-1-chalianis1@gmail.com \
--to=chalianis1@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox