Skip to content

Commit 142b876

Browse files
committed
pinctrl: ingenic: 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: Thierry Reding <[email protected]> Acked-by: Zhou Yanjie <[email protected]> Acked-by: Paul Cercueil <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b587c30 commit 142b876

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/pinctrl/pinctrl-ingenic.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,6 +1940,7 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc,
19401940
{
19411941
struct ingenic_gpio_chip *jzgc;
19421942
struct device *dev = jzpc->dev;
1943+
struct gpio_irq_chip *girq;
19431944
unsigned int bank;
19441945
int err;
19451946

@@ -1982,10 +1983,6 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc,
19821983
jzgc->gc.free = gpiochip_generic_free;
19831984
}
19841985

1985-
err = devm_gpiochip_add_data(dev, &jzgc->gc, jzgc);
1986-
if (err)
1987-
return err;
1988-
19891986
jzgc->irq = irq_of_parse_and_map(node, 0);
19901987
if (!jzgc->irq)
19911988
return -EINVAL;
@@ -2000,13 +1997,22 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc,
20001997
jzgc->irq_chip.irq_set_wake = ingenic_gpio_irq_set_wake;
20011998
jzgc->irq_chip.flags = IRQCHIP_MASK_ON_SUSPEND;
20021999

2003-
err = gpiochip_irqchip_add(&jzgc->gc, &jzgc->irq_chip, 0,
2004-
handle_level_irq, IRQ_TYPE_NONE);
2000+
girq = &jzgc->gc.irq;
2001+
girq->chip = &jzgc->irq_chip;
2002+
girq->parent_handler = ingenic_gpio_irq_handler;
2003+
girq->num_parents = 1;
2004+
girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
2005+
GFP_KERNEL);
2006+
if (!girq->parents)
2007+
return -ENOMEM;
2008+
girq->parents[0] = jzgc->irq;
2009+
girq->default_type = IRQ_TYPE_NONE;
2010+
girq->handler = handle_level_irq;
2011+
2012+
err = devm_gpiochip_add_data(dev, &jzgc->gc, jzgc);
20052013
if (err)
20062014
return err;
20072015

2008-
gpiochip_set_chained_irqchip(&jzgc->gc, &jzgc->irq_chip,
2009-
jzgc->irq, ingenic_gpio_irq_handler);
20102016
return 0;
20112017
}
20122018

0 commit comments

Comments
 (0)