pinctrl: sirf: 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: Barry Song <baohua@kernel.org> Cc: Yuping Luo <yuping.luo@csr.com> Cc: Rongjun Ying <rongjun.ying@csr.com> Cc: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20190913113530.5536-5-linus.walleij@linaro.org
This commit is contained in:
parent
de0221f620
commit
aead399140
|
@ -785,6 +785,7 @@ static int sirfsoc_gpio_probe(struct device_node *np)
|
||||||
struct sirfsoc_gpio_bank *bank;
|
struct sirfsoc_gpio_bank *bank;
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
|
struct gpio_irq_chip *girq;
|
||||||
|
|
||||||
u32 pullups[SIRFSOC_GPIO_NO_OF_BANKS], pulldowns[SIRFSOC_GPIO_NO_OF_BANKS];
|
u32 pullups[SIRFSOC_GPIO_NO_OF_BANKS], pulldowns[SIRFSOC_GPIO_NO_OF_BANKS];
|
||||||
|
|
||||||
|
@ -816,36 +817,33 @@ static int sirfsoc_gpio_probe(struct device_node *np)
|
||||||
sgpio->chip.gc.parent = &pdev->dev;
|
sgpio->chip.gc.parent = &pdev->dev;
|
||||||
sgpio->chip.regs = regs;
|
sgpio->chip.regs = regs;
|
||||||
|
|
||||||
err = gpiochip_add_data(&sgpio->chip.gc, sgpio);
|
girq = &sgpio->chip.gc.irq;
|
||||||
if (err) {
|
girq->chip = &sirfsoc_irq_chip;
|
||||||
dev_err(&pdev->dev, "%pOF: error in probe function with status %d\n",
|
girq->parent_handler = sirfsoc_gpio_handle_irq;
|
||||||
np, err);
|
girq->num_parents = SIRFSOC_GPIO_NO_OF_BANKS;
|
||||||
goto out;
|
girq->parents = devm_kcalloc(&pdev->dev, SIRFSOC_GPIO_NO_OF_BANKS,
|
||||||
}
|
sizeof(*girq->parents),
|
||||||
|
GFP_KERNEL);
|
||||||
err = gpiochip_irqchip_add(&sgpio->chip.gc,
|
if (!girq->parents)
|
||||||
&sirfsoc_irq_chip,
|
return -ENOMEM;
|
||||||
0, handle_level_irq,
|
|
||||||
IRQ_TYPE_NONE);
|
|
||||||
if (err) {
|
|
||||||
dev_err(&pdev->dev,
|
|
||||||
"could not connect irqchip to gpiochip\n");
|
|
||||||
goto out_banks;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
|
for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
|
||||||
bank = &sgpio->sgpio_bank[i];
|
bank = &sgpio->sgpio_bank[i];
|
||||||
spin_lock_init(&bank->lock);
|
spin_lock_init(&bank->lock);
|
||||||
bank->parent_irq = platform_get_irq(pdev, i);
|
bank->parent_irq = platform_get_irq(pdev, i);
|
||||||
if (bank->parent_irq < 0) {
|
if (bank->parent_irq < 0) {
|
||||||
err = bank->parent_irq;
|
err = bank->parent_irq;
|
||||||
goto out_banks;
|
goto out;
|
||||||
}
|
}
|
||||||
|
girq->parents[i] = bank->parent_irq;
|
||||||
|
}
|
||||||
|
girq->default_type = IRQ_TYPE_NONE;
|
||||||
|
girq->handler = handle_level_irq;
|
||||||
|
|
||||||
gpiochip_set_chained_irqchip(&sgpio->chip.gc,
|
err = gpiochip_add_data(&sgpio->chip.gc, sgpio);
|
||||||
&sirfsoc_irq_chip,
|
if (err) {
|
||||||
bank->parent_irq,
|
dev_err(&pdev->dev, "%pOF: error in probe function with status %d\n",
|
||||||
sirfsoc_gpio_handle_irq);
|
np, err);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = gpiochip_add_pin_range(&sgpio->chip.gc, dev_name(&pdev->dev),
|
err = gpiochip_add_pin_range(&sgpio->chip.gc, dev_name(&pdev->dev),
|
||||||
|
@ -867,7 +865,6 @@ static int sirfsoc_gpio_probe(struct device_node *np)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_no_range:
|
out_no_range:
|
||||||
out_banks:
|
|
||||||
gpiochip_remove(&sgpio->chip.gc);
|
gpiochip_remove(&sgpio->chip.gc);
|
||||||
out:
|
out:
|
||||||
iounmap(regs);
|
iounmap(regs);
|
||||||
|
|
Loading…
Reference in New Issue