Skip to content

Commit bb58a47

Browse files
committed
gpio: max732x: 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: Sam Protsenko <[email protected]> Reviewed-by: Sam Protsenko <[email protected]> Cc: Sam Protsenko <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent beb3fb4 commit bb58a47

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

drivers/gpio/gpio-max732x.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ static int max732x_irq_setup(struct max732x_chip *chip,
503503

504504
if (((pdata && pdata->irq_base) || client->irq)
505505
&& has_irq != INT_NONE) {
506+
struct gpio_irq_chip *girq;
507+
506508
if (pdata)
507509
irq_base = pdata->irq_base;
508510
chip->irq_features = has_irq;
@@ -517,19 +519,17 @@ static int max732x_irq_setup(struct max732x_chip *chip,
517519
client->irq);
518520
return ret;
519521
}
520-
ret = gpiochip_irqchip_add_nested(&chip->gpio_chip,
521-
&max732x_irq_chip,
522-
irq_base,
523-
handle_simple_irq,
524-
IRQ_TYPE_NONE);
525-
if (ret) {
526-
dev_err(&client->dev,
527-
"could not connect irqchip to gpiochip\n");
528-
return ret;
529-
}
530-
gpiochip_set_nested_irqchip(&chip->gpio_chip,
531-
&max732x_irq_chip,
532-
client->irq);
522+
523+
girq = &chip->gpio_chip.irq;
524+
girq->chip = &max732x_irq_chip;
525+
/* This will let us handle the parent IRQ in the driver */
526+
girq->parent_handler = NULL;
527+
girq->num_parents = 0;
528+
girq->parents = NULL;
529+
girq->default_type = IRQ_TYPE_NONE;
530+
girq->handler = handle_simple_irq;
531+
girq->threaded = true;
532+
girq->first = irq_base; /* FIXME: get rid of this */
533533
}
534534

535535
return 0;
@@ -695,11 +695,11 @@ static int max732x_probe(struct i2c_client *client,
695695
return ret;
696696
}
697697

698-
ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
698+
ret = max732x_irq_setup(chip, id);
699699
if (ret)
700700
return ret;
701701

702-
ret = max732x_irq_setup(chip, id);
702+
ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip);
703703
if (ret)
704704
return ret;
705705

0 commit comments

Comments
 (0)