Commit edee3bc6 authored by Linus Walleij's avatar Linus Walleij

gpio: pca953x: Use irqchip template

This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Tested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/20200717144040.63253-1-linus.walleij@linaro.org
parent 75dec567
...@@ -834,6 +834,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base) ...@@ -834,6 +834,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base)
struct irq_chip *irq_chip = &chip->irq_chip; struct irq_chip *irq_chip = &chip->irq_chip;
DECLARE_BITMAP(reg_direction, MAX_LINE); DECLARE_BITMAP(reg_direction, MAX_LINE);
DECLARE_BITMAP(irq_stat, MAX_LINE); DECLARE_BITMAP(irq_stat, MAX_LINE);
struct gpio_irq_chip *girq;
int ret; int ret;
if (dmi_first_match(pca953x_dmi_acpi_irq_info)) { if (dmi_first_match(pca953x_dmi_acpi_irq_info)) {
...@@ -883,16 +884,16 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base) ...@@ -883,16 +884,16 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base)
irq_chip->irq_set_type = pca953x_irq_set_type; irq_chip->irq_set_type = pca953x_irq_set_type;
irq_chip->irq_shutdown = pca953x_irq_shutdown; irq_chip->irq_shutdown = pca953x_irq_shutdown;
ret = gpiochip_irqchip_add_nested(&chip->gpio_chip, irq_chip, girq = &chip->gpio_chip.irq;
irq_base, handle_simple_irq, girq->chip = irq_chip;
IRQ_TYPE_NONE); /* This will let us handle the parent IRQ in the driver */
if (ret) { girq->parent_handler = NULL;
dev_err(&client->dev, girq->num_parents = 0;
"could not connect irqchip to gpiochip\n"); girq->parents = NULL;
return ret; girq->default_type = IRQ_TYPE_NONE;
} girq->handler = handle_simple_irq;
girq->threaded = true;
gpiochip_set_nested_irqchip(&chip->gpio_chip, irq_chip, client->irq); girq->first = irq_base; /* FIXME: get rid of this */
return 0; return 0;
} }
...@@ -1080,11 +1081,11 @@ static int pca953x_probe(struct i2c_client *client, ...@@ -1080,11 +1081,11 @@ static int pca953x_probe(struct i2c_client *client,
if (ret) if (ret)
goto err_exit; goto err_exit;
ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip); ret = pca953x_irq_setup(chip, irq_base);
if (ret) if (ret)
goto err_exit; goto err_exit;
ret = pca953x_irq_setup(chip, irq_base); ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
if (ret) if (ret)
goto err_exit; goto err_exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment