Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+14 -6
+14 -6
drivers/gpio/gpio-sodaville.c
··· 9 9 10 10 #include <linux/errno.h> 11 11 #include <linux/gpio/driver.h> 12 + #include <linux/gpio/generic.h> 12 13 #include <linux/init.h> 13 14 #include <linux/interrupt.h> 14 15 #include <linux/io.h> ··· 40 39 void __iomem *gpio_pub_base; 41 40 struct irq_domain *id; 42 41 struct irq_chip_generic *gc; 43 - struct gpio_chip chip; 42 + struct gpio_generic_chip gen_gc; 44 43 }; 45 44 46 45 static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type) ··· 181 180 static int sdv_gpio_probe(struct pci_dev *pdev, 182 181 const struct pci_device_id *pci_id) 183 182 { 183 + struct gpio_generic_chip_config config; 184 184 struct sdv_gpio_chip_data *sd; 185 185 int ret; 186 186 u32 mux_val; ··· 208 206 if (!ret) 209 207 writel(mux_val, sd->gpio_pub_base + GPMUXCTL); 210 208 211 - ret = bgpio_init(&sd->chip, &pdev->dev, 4, 212 - sd->gpio_pub_base + GPINR, sd->gpio_pub_base + GPOUTR, 213 - NULL, sd->gpio_pub_base + GPOER, NULL, 0); 209 + config = (struct gpio_generic_chip_config) { 210 + .dev = &pdev->dev, 211 + .sz = 4, 212 + .dat = sd->gpio_pub_base + GPINR, 213 + .set = sd->gpio_pub_base + GPOUTR, 214 + .dirout = sd->gpio_pub_base + GPOER, 215 + }; 216 + 217 + ret = gpio_generic_chip_init(&sd->gen_gc, &config); 214 218 if (ret) 215 219 return ret; 216 220 217 - sd->chip.ngpio = SDV_NUM_PUB_GPIOS; 221 + sd->gen_gc.gc.ngpio = SDV_NUM_PUB_GPIOS; 218 222 219 - ret = devm_gpiochip_add_data(&pdev->dev, &sd->chip, sd); 223 + ret = devm_gpiochip_add_data(&pdev->dev, &sd->gen_gc.gc, sd); 220 224 if (ret < 0) { 221 225 dev_err(&pdev->dev, "gpiochip_add() failed.\n"); 222 226 return ret;