mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
gpio: ep93xx: use new generic GPIO chip API
Convert the driver to using the new generic GPIO chip interfaces from linux/gpio/generic.h. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20250903-gpio-mmio-gpio-conv-part3-v1-11-ff346509f408@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
a685ac6539
commit
ab61c8b613
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user