mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
pinctrl: spear/plgpio: 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: Shiraz Hashim <shiraz.linux.kernel@gmail.com> Cc: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://lore.kernel.org/r/20190913113530.5536-3-linus.walleij@linaro.org
This commit is contained in:
parent
835513b0fb
commit
face7c04b0
@ -569,40 +569,35 @@ static int plgpio_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq > 0) {
|
||||
struct gpio_irq_chip *girq;
|
||||
|
||||
girq = &plgpio->chip.irq;
|
||||
girq->chip = &plgpio_irqchip;
|
||||
girq->parent_handler = plgpio_irq_handler;
|
||||
girq->num_parents = 1;
|
||||
girq->parents = devm_kcalloc(&pdev->dev, 1,
|
||||
sizeof(*girq->parents),
|
||||
GFP_KERNEL);
|
||||
if (!girq->parents)
|
||||
return -ENOMEM;
|
||||
girq->parents[0] = irq;
|
||||
girq->default_type = IRQ_TYPE_NONE;
|
||||
girq->handler = handle_simple_irq;
|
||||
dev_info(&pdev->dev, "PLGPIO registering with IRQs\n");
|
||||
} else {
|
||||
dev_info(&pdev->dev, "PLGPIO registering without IRQs\n");
|
||||
}
|
||||
|
||||
ret = gpiochip_add_data(&plgpio->chip, plgpio);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "unable to add gpio chip\n");
|
||||
goto unprepare_clk;
|
||||
}
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0) {
|
||||
dev_info(&pdev->dev, "PLGPIO registered without IRQs\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = gpiochip_irqchip_add(&plgpio->chip,
|
||||
&plgpio_irqchip,
|
||||
0,
|
||||
handle_simple_irq,
|
||||
IRQ_TYPE_NONE);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to add irqchip to gpiochip\n");
|
||||
goto remove_gpiochip;
|
||||
}
|
||||
|
||||
gpiochip_set_chained_irqchip(&plgpio->chip,
|
||||
&plgpio_irqchip,
|
||||
irq,
|
||||
plgpio_irq_handler);
|
||||
|
||||
dev_info(&pdev->dev, "PLGPIO registered with IRQs\n");
|
||||
|
||||
return 0;
|
||||
|
||||
remove_gpiochip:
|
||||
dev_info(&pdev->dev, "Remove gpiochip\n");
|
||||
gpiochip_remove(&plgpio->chip);
|
||||
unprepare_clk:
|
||||
if (!IS_ERR(plgpio->clk))
|
||||
clk_unprepare(plgpio->clk);
|
||||
|
Loading…
Reference in New Issue
Block a user