Skip to content

Commit edee3bc

Browse files
committed
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: Linus Walleij <[email protected]> Tested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Uwe Kleine-König <[email protected]> Cc: Adam Ford <[email protected]> Cc: Vignesh Raghavendra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 75dec56 commit edee3bc

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

drivers/gpio/gpio-pca953x.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base)
834834
struct irq_chip *irq_chip = &chip->irq_chip;
835835
DECLARE_BITMAP(reg_direction, MAX_LINE);
836836
DECLARE_BITMAP(irq_stat, MAX_LINE);
837+
struct gpio_irq_chip *girq;
837838
int ret;
838839

839840
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)
883884
irq_chip->irq_set_type = pca953x_irq_set_type;
884885
irq_chip->irq_shutdown = pca953x_irq_shutdown;
885886

886-
ret = gpiochip_irqchip_add_nested(&chip->gpio_chip, irq_chip,
887-
irq_base, handle_simple_irq,
888-
IRQ_TYPE_NONE);
889-
if (ret) {
890-
dev_err(&client->dev,
891-
"could not connect irqchip to gpiochip\n");
892-
return ret;
893-
}
894-
895-
gpiochip_set_nested_irqchip(&chip->gpio_chip, irq_chip, client->irq);
887+
girq = &chip->gpio_chip.irq;
888+
girq->chip = irq_chip;
889+
/* This will let us handle the parent IRQ in the driver */
890+
girq->parent_handler = NULL;
891+
girq->num_parents = 0;
892+
girq->parents = NULL;
893+
girq->default_type = IRQ_TYPE_NONE;
894+
girq->handler = handle_simple_irq;
895+
girq->threaded = true;
896+
girq->first = irq_base; /* FIXME: get rid of this */
896897

897898
return 0;
898899
}
@@ -1080,11 +1081,11 @@ static int pca953x_probe(struct i2c_client *client,
10801081
if (ret)
10811082
goto err_exit;
10821083

1083-
ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
1084+
ret = pca953x_irq_setup(chip, irq_base);
10841085
if (ret)
10851086
goto err_exit;
10861087

1087-
ret = pca953x_irq_setup(chip, irq_base);
1088+
ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
10881089
if (ret)
10891090
goto err_exit;
10901091

0 commit comments

Comments
 (0)