Skip to content

Commit ae9a529

Browse files
author
Bartosz Golaszewski
committed
gpio: sodaville: use new generic GPIO chip API
Convert the driver to using the new generic GPIO chip interfaces from linux/gpio/generic.h. Reviewed-by: Andy Shevchenko <andy@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20250910-gpio-mmio-gpio-conv-part4-v2-13-f3d1a4c57124@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 0634111 commit ae9a529

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

drivers/gpio/gpio-sodaville.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/errno.h>
1111
#include <linux/gpio/driver.h>
12+
#include <linux/gpio/generic.h>
1213
#include <linux/init.h>
1314
#include <linux/interrupt.h>
1415
#include <linux/io.h>
@@ -39,7 +40,7 @@ struct sdv_gpio_chip_data {
3940
void __iomem *gpio_pub_base;
4041
struct irq_domain *id;
4142
struct irq_chip_generic *gc;
42-
struct gpio_chip chip;
43+
struct gpio_generic_chip gen_gc;
4344
};
4445

4546
static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type)
@@ -180,6 +181,7 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,
180181
static int sdv_gpio_probe(struct pci_dev *pdev,
181182
const struct pci_device_id *pci_id)
182183
{
184+
struct gpio_generic_chip_config config;
183185
struct sdv_gpio_chip_data *sd;
184186
int ret;
185187
u32 mux_val;
@@ -206,15 +208,21 @@ static int sdv_gpio_probe(struct pci_dev *pdev,
206208
if (!ret)
207209
writel(mux_val, sd->gpio_pub_base + GPMUXCTL);
208210

209-
ret = bgpio_init(&sd->chip, &pdev->dev, 4,
210-
sd->gpio_pub_base + GPINR, sd->gpio_pub_base + GPOUTR,
211-
NULL, sd->gpio_pub_base + GPOER, NULL, 0);
211+
config = (struct gpio_generic_chip_config) {
212+
.dev = &pdev->dev,
213+
.sz = 4,
214+
.dat = sd->gpio_pub_base + GPINR,
215+
.set = sd->gpio_pub_base + GPOUTR,
216+
.dirout = sd->gpio_pub_base + GPOER,
217+
};
218+
219+
ret = gpio_generic_chip_init(&sd->gen_gc, &config);
212220
if (ret)
213221
return ret;
214222

215-
sd->chip.ngpio = SDV_NUM_PUB_GPIOS;
223+
sd->gen_gc.gc.ngpio = SDV_NUM_PUB_GPIOS;
216224

217-
ret = devm_gpiochip_add_data(&pdev->dev, &sd->chip, sd);
225+
ret = devm_gpiochip_add_data(&pdev->dev, &sd->gen_gc.gc, sd);
218226
if (ret < 0) {
219227
dev_err(&pdev->dev, "gpiochip_add() failed.\n");
220228
return ret;

0 commit comments

Comments
 (0)