gpio: tegra186: Allow optional irq parent callbacks
authorMarc Zyngier <maz@kernel.org>
Mon, 5 Oct 2020 09:27:27 +0000 (10:27 +0100)
committerMarc Zyngier <maz@kernel.org>
Sat, 10 Oct 2020 11:12:10 +0000 (12:12 +0100)
Make the tegra186 GPIO driver resistent to variable depth
interrupt hierarchy, which we are about to introduce.

No functionnal change yet.

Signed-off-by: Marc Zyngier <maz@kernel.org>
drivers/gpio/gpio-tegra186.c

index 178e9128ded0b0e07a06ab81f84d7030ba2dd19e..9500074b1f1b55e00951af9b7b9f2d956f37a7ef 100644 (file)
@@ -430,7 +430,18 @@ static int tegra186_irq_set_type(struct irq_data *data, unsigned int type)
        else
                irq_set_handler_locked(data, handle_edge_irq);
 
-       return irq_chip_set_type_parent(data, type);
+       if (data->parent_data)
+               return irq_chip_set_type_parent(data, type);
+
+       return 0;
+}
+
+static int tegra186_irq_set_wake(struct irq_data *data, unsigned int on)
+{
+       if (data->parent_data)
+               return irq_chip_set_wake_parent(data, on);
+
+       return 0;
 }
 
 static void tegra186_gpio_irq(struct irq_desc *desc)
@@ -678,7 +689,7 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
        gpio->intc.irq_mask = tegra186_irq_mask;
        gpio->intc.irq_unmask = tegra186_irq_unmask;
        gpio->intc.irq_set_type = tegra186_irq_set_type;
-       gpio->intc.irq_set_wake = irq_chip_set_wake_parent;
+       gpio->intc.irq_set_wake = tegra186_irq_set_wake;
 
        irq = &gpio->gpio.irq;
        irq->chip = &gpio->intc;