Commit b470cef1 authored by Linus Walleij's avatar Linus Walleij
Browse files

gpio: rcar: Use irqchip template



This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit call to gpiochip_irqchip_add().

The irqchip is instead added while adding the gpiochip.

Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Cc: Biju Das <biju.das@bp.renesas.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20200722113141.243163-1-linus.walleij@linaro.org
parent a070bdbb
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -438,6 +438,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
	struct resource *irq;
	struct gpio_chip *gpio_chip;
	struct irq_chip *irq_chip;
	struct gpio_irq_chip *girq;
	struct device *dev = &pdev->dev;
	const char *name = dev_name(dev);
	unsigned int npins;
@@ -496,19 +497,21 @@ static int gpio_rcar_probe(struct platform_device *pdev)
	irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
	irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;

	girq = &gpio_chip->irq;
	girq->chip = irq_chip;
	/* This will let us handle the parent IRQ in the driver */
	girq->parent_handler = NULL;
	girq->num_parents = 0;
	girq->parents = NULL;
	girq->default_type = IRQ_TYPE_NONE;
	girq->handler = handle_level_irq;

	ret = gpiochip_add_data(gpio_chip, p);
	if (ret) {
		dev_err(dev, "failed to add GPIO controller\n");
		goto err0;
	}

	ret = gpiochip_irqchip_add(gpio_chip, irq_chip, 0, handle_level_irq,
				   IRQ_TYPE_NONE);
	if (ret) {
		dev_err(dev, "cannot add irqchip\n");
		goto err1;
	}

	p->irq_parent = irq->start;
	if (devm_request_irq(dev, irq->start, gpio_rcar_irq_handler,
			     IRQF_SHARED, name, p)) {