Skip to content

Commit b475764

Browse files
committed
pinctrl: pistachio: Pass irqchip when adding gpiochip
We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For more info see drivers/gpio/TODO. For chained irqchips this is a pretty straight-forward conversion. Cc: Andrew Bresticker <[email protected]> Cc: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Acked-by: James Hartley <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2851ef5 commit b475764

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

drivers/pinctrl/pinctrl-pistachio.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
13521352
for (i = 0; i < pctl->nbanks; i++) {
13531353
char child_name[sizeof("gpioXX")];
13541354
struct device_node *child;
1355+
struct gpio_irq_chip *girq;
13551356

13561357
snprintf(child_name, sizeof(child_name), "gpio%d", i);
13571358
child = of_get_child_by_name(node, child_name);
@@ -1383,23 +1384,28 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
13831384

13841385
bank->gpio_chip.parent = pctl->dev;
13851386
bank->gpio_chip.of_node = child;
1386-
ret = gpiochip_add_data(&bank->gpio_chip, bank);
1387-
if (ret < 0) {
1388-
dev_err(pctl->dev, "Failed to add GPIO chip %u: %d\n",
1389-
i, ret);
1387+
1388+
girq = &bank->gpio_chip.irq;
1389+
girq->chip = &bank->irq_chip;
1390+
girq->parent_handler = pistachio_gpio_irq_handler;
1391+
girq->num_parents = 1;
1392+
girq->parents = devm_kcalloc(pctl->dev, 1,
1393+
sizeof(*girq->parents),
1394+
GFP_KERNEL);
1395+
if (!girq->parents) {
1396+
ret = -ENOMEM;
13901397
goto err;
13911398
}
1399+
girq->parents[0] = irq;
1400+
girq->default_type = IRQ_TYPE_NONE;
1401+
girq->handler = handle_level_irq;
13921402

1393-
ret = gpiochip_irqchip_add(&bank->gpio_chip, &bank->irq_chip,
1394-
0, handle_level_irq, IRQ_TYPE_NONE);
1403+
ret = gpiochip_add_data(&bank->gpio_chip, bank);
13951404
if (ret < 0) {
1396-
dev_err(pctl->dev, "Failed to add IRQ chip %u: %d\n",
1405+
dev_err(pctl->dev, "Failed to add GPIO chip %u: %d\n",
13971406
i, ret);
1398-
gpiochip_remove(&bank->gpio_chip);
13991407
goto err;
14001408
}
1401-
gpiochip_set_chained_irqchip(&bank->gpio_chip, &bank->irq_chip,
1402-
irq, pistachio_gpio_irq_handler);
14031409

14041410
ret = gpiochip_add_pin_range(&bank->gpio_chip,
14051411
dev_name(pctl->dev), 0,

0 commit comments

Comments
 (0)