From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Linus Walleij <linusw@kernel.org>,
Imre Kaloz <kaloz@openwrt.org>,
James Cowgill <james.cowgill@blaize.com>,
Matt Redfearn <matt.redfearn@blaize.com>,
Neil Jones <neil.jones@blaize.com>,
Nikolaos Pasaloukos <nikolaos.pasaloukos@blaize.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 11/12] gpio: ep93xx: use new generic GPIO chip API
Date: Wed, 03 Sep 2025 10:00:15 +0200 [thread overview]
Message-ID: <20250903-gpio-mmio-gpio-conv-part3-v1-11-ff346509f408@linaro.org> (raw)
In-Reply-To: <20250903-gpio-mmio-gpio-conv-part3-v1-0-ff346509f408@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Convert the driver to using the new generic GPIO chip interfaces from
linux/gpio/generic.h.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-ep93xx.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c
index 08e5ae8bf4d1a80ca26680a3c7bff0b8039fa41a..c6c8170813331be567048980710226792b4b2a02 100644
--- a/drivers/gpio/gpio-ep93xx.c
+++ b/drivers/gpio/gpio-ep93xx.c
@@ -11,6 +11,7 @@
#include <linux/bitops.h>
#include <linux/gpio/driver.h>
+#include <linux/gpio/generic.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
@@ -31,11 +32,14 @@ struct ep93xx_gpio_irq_chip {
struct ep93xx_gpio_chip {
void __iomem *base;
- struct gpio_chip gc;
+ struct gpio_generic_chip chip;
struct ep93xx_gpio_irq_chip *eic;
};
-#define to_ep93xx_gpio_chip(x) container_of(x, struct ep93xx_gpio_chip, gc)
+static struct ep93xx_gpio_chip *to_ep93xx_gpio_chip(struct gpio_chip *gc)
+{
+ return container_of(to_gpio_generic_chip(gc), struct ep93xx_gpio_chip, chip);
+}
static struct ep93xx_gpio_irq_chip *to_ep93xx_gpio_irq_chip(struct gpio_chip *gc)
{
@@ -267,7 +271,7 @@ static const struct irq_chip gpio_eic_irq_chip = {
static int ep93xx_setup_irqs(struct platform_device *pdev,
struct ep93xx_gpio_chip *egc)
{
- struct gpio_chip *gc = &egc->gc;
+ struct gpio_chip *gc = &egc->chip.gc;
struct device *dev = &pdev->dev;
struct gpio_irq_chip *girq = &gc->irq;
int ret, irq, i;
@@ -327,6 +331,7 @@ static int ep93xx_setup_irqs(struct platform_device *pdev,
static int ep93xx_gpio_probe(struct platform_device *pdev)
{
+ struct gpio_generic_chip_config config;
struct ep93xx_gpio_chip *egc;
struct gpio_chip *gc;
void __iomem *data;
@@ -345,8 +350,16 @@ static int ep93xx_gpio_probe(struct platform_device *pdev)
if (IS_ERR(dir))
return PTR_ERR(dir);
- gc = &egc->gc;
- ret = bgpio_init(gc, &pdev->dev, 1, data, NULL, NULL, dir, NULL, 0);
+ gc = &egc->chip.gc;
+
+ config = (typeof(config)){
+ .dev = &pdev->dev,
+ .sz = 1,
+ .dat = data,
+ .dirout = dir,
+ };
+
+ ret = gpio_generic_chip_init(&egc->chip, &config);
if (ret)
return dev_err_probe(&pdev->dev, ret, "unable to init generic GPIO\n");
--
2.48.1
next prev parent reply other threads:[~2025-09-03 9:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 8:00 [PATCH 00/12] gpio: replace legacy bgpio_init() with its modernized alternative - part 3 Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 01/12] gpio: ixp4xx: allow building the module with COMPILE_TEST enabled Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 02/12] gpio: ixp4xx: use new generic GPIO chip API Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 03/12] gpio: idt3243x: " Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 04/12] gpio: blzp1600: " Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 05/12] gpio: tb10x: order includes alphabetically Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 06/12] gpio: tb10x: allow building the module with COMPILE_TEST=y Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 07/12] gpio: tb10x: use new generic GPIO chip API Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 08/12] gpio: mlxbf: " Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 09/12] gpio: ep93xx: allow building the module with COMPILE_TEST enabled Bartosz Golaszewski
2025-09-03 8:00 ` [PATCH 10/12] gpio: ep93xx: order includes alphabetically Bartosz Golaszewski
2025-09-03 8:00 ` Bartosz Golaszewski [this message]
2025-09-03 8:00 ` [PATCH 12/12] gpio: mlxbf3: use new generic GPIO chip API 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=20250903-gpio-mmio-gpio-conv-part3-v1-11-ff346509f408@linaro.org \
--to=brgl@bgdev.pl \
--cc=bartosz.golaszewski@linaro.org \
--cc=james.cowgill@blaize.com \
--cc=kaloz@openwrt.org \
--cc=linus.walleij@linaro.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.redfearn@blaize.com \
--cc=neil.jones@blaize.com \
--cc=nikolaos.pasaloukos@blaize.com \
/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).