Commit a2ac3eb3 authored by Linus Walleij's avatar Linus Walleij

gpio: hlwd: 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 <treding@nvidia.com>
Link: https://lore.kernel.org/r/20190809140005.11654-1-linus.walleij@linaro.orgReviewed-by: default avatarJonathan Neuschäfer <j.neuschaefer@gmx.net>
Tested-by: default avatarJonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c7e66e48
...@@ -244,20 +244,16 @@ static int hlwd_gpio_probe(struct platform_device *pdev) ...@@ -244,20 +244,16 @@ static int hlwd_gpio_probe(struct platform_device *pdev)
ngpios = 32; ngpios = 32;
hlwd->gpioc.ngpio = ngpios; hlwd->gpioc.ngpio = ngpios;
res = devm_gpiochip_add_data(&pdev->dev, &hlwd->gpioc, hlwd);
if (res)
return res;
/* Mask and ack all interrupts */ /* Mask and ack all interrupts */
iowrite32be(0, hlwd->regs + HW_GPIOB_INTMASK); iowrite32be(0, hlwd->regs + HW_GPIOB_INTMASK);
iowrite32be(0xffffffff, hlwd->regs + HW_GPIOB_INTFLAG); iowrite32be(0xffffffff, hlwd->regs + HW_GPIOB_INTFLAG);
/* /*
* If this GPIO controller is not marked as an interrupt controller in * If this GPIO controller is not marked as an interrupt controller in
* the DT, return. * the DT, skip interrupt support.
*/ */
if (!of_property_read_bool(pdev->dev.of_node, "interrupt-controller")) if (of_property_read_bool(pdev->dev.of_node, "interrupt-controller")) {
return 0; struct gpio_irq_chip *girq;
hlwd->irq = platform_get_irq(pdev, 0); hlwd->irq = platform_get_irq(pdev, 0);
if (hlwd->irq < 0) { if (hlwd->irq < 0) {
...@@ -272,15 +268,21 @@ static int hlwd_gpio_probe(struct platform_device *pdev) ...@@ -272,15 +268,21 @@ static int hlwd_gpio_probe(struct platform_device *pdev)
hlwd->irqc.irq_enable = hlwd_gpio_irq_enable; hlwd->irqc.irq_enable = hlwd_gpio_irq_enable;
hlwd->irqc.irq_set_type = hlwd_gpio_irq_set_type; hlwd->irqc.irq_set_type = hlwd_gpio_irq_set_type;
res = gpiochip_irqchip_add(&hlwd->gpioc, &hlwd->irqc, 0, girq = &hlwd->gpioc.irq;
handle_level_irq, IRQ_TYPE_NONE); girq->chip = &hlwd->irqc;
if (res) girq->parent_handler = hlwd_gpio_irqhandler;
return res; girq->num_parents = 1;
girq->parents = devm_kcalloc(&pdev->dev, 1,
gpiochip_set_chained_irqchip(&hlwd->gpioc, &hlwd->irqc, sizeof(*girq->parents),
hlwd->irq, hlwd_gpio_irqhandler); GFP_KERNEL);
if (!girq->parents)
return -ENOMEM;
girq->parents[0] = hlwd->irq;
girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_level_irq;
}
return 0; return devm_gpiochip_add_data(&pdev->dev, &hlwd->gpioc, hlwd);
} }
static const struct of_device_id hlwd_gpio_match[] = { static const struct of_device_id hlwd_gpio_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment