From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Yinbo Zhu <zhuyinbo@loongson.cn>,
Hoan Tran <hoan@os.amperecomputing.com>,
Manivannan Sadhasivam <mani@kernel.org>,
Yang Shen <shenyang39@huawei.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-unisoc@lists.infradead.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 01/14] gpio: generic: provide to_gpio_generic_chip()
Date: Tue, 12 Aug 2025 11:51:58 +0200 [thread overview]
Message-ID: <20250812-gpio-mmio-gpio-conv-v1-1-9f43e95dea98@linaro.org> (raw)
In-Reply-To: <20250812-gpio-mmio-gpio-conv-v1-0-9f43e95dea98@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Provide a helper allowing to convert a struct gpio_chip address to the
struct gpio_generic_chip that wraps it.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
include/linux/gpio/generic.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/gpio/generic.h b/include/linux/gpio/generic.h
index f3a8db4598bb59f1dba4fbebace24dc10be44ae4..5a85ecbef8d234d9cf0c2f1db7a97f5f3781b2e4 100644
--- a/include/linux/gpio/generic.h
+++ b/include/linux/gpio/generic.h
@@ -55,6 +55,12 @@ struct gpio_generic_chip {
struct gpio_chip gc;
};
+static inline struct gpio_generic_chip *
+to_gpio_generic_chip(struct gpio_chip *gc)
+{
+ return container_of(gc, struct gpio_generic_chip, gc);
+}
+
/**
* gpio_generic_chip_init() - Initialize a generic GPIO chip.
* @chip: Generic GPIO chip to set up.
--
2.48.1
next prev parent reply other threads:[~2025-08-12 9:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 9:51 [PATCH 00/14] gpio: replace legacy bgpio_init() with its modernized alternative Bartosz Golaszewski
2025-08-12 9:51 ` Bartosz Golaszewski [this message]
2025-08-19 10:17 ` [PATCH 01/14] gpio: generic: provide to_gpio_generic_chip() Linus Walleij
2025-08-12 9:51 ` [PATCH 02/14] gpio: generic: provide helpers for reading and writing registers Bartosz Golaszewski
2025-08-12 9:52 ` [PATCH 03/14] gpio: hisi: use the BGPIOF_UNREADABLE_REG_DIR flag Bartosz Golaszewski
2025-08-12 9:52 ` [PATCH 04/14] gpio: ts4800: remove the unnecessary call to platform_set_drvdata() Bartosz Golaszewski
2025-08-12 9:52 ` [PATCH 05/14] gpio: ts4800: use generic device properties 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=20250812-gpio-mmio-gpio-conv-v1-1-9f43e95dea98@linaro.org \
--to=brgl@bgdev.pl \
--cc=bartosz.golaszewski@linaro.org \
--cc=hoan@os.amperecomputing.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unisoc@lists.infradead.org \
--cc=mani@kernel.org \
--cc=shenyang39@huawei.com \
--cc=zhuyinbo@loongson.cn \
/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;
as well as URLs for NNTP newsgroup(s).