gpio: ixp4xx: Make irqchip immutable

This turns the IXP4xx GPIO irqchip into an immutable
irqchip, a bit different from the standard template due
to being hierarchical.

Tested on the IXP4xx which uses drivers/ata/pata_ixp4xx_cf.c
for a rootfs on compact flash with IRQs from this GPIO
block to the CF ATA controller.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>

authored by Linus Walleij and committed by Bartosz Golaszewski 94e9bc73 1660c679

Changed files
+14 -3
drivers
+14 -3
drivers/gpio/gpio-ixp4xx.c
··· 63 63 __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS); 64 64 } 65 65 66 + static void ixp4xx_gpio_mask_irq(struct irq_data *d) 67 + { 68 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 69 + 70 + irq_chip_mask_parent(d); 71 + gpiochip_disable_irq(gc, d->hwirq); 72 + } 73 + 66 74 static void ixp4xx_gpio_irq_unmask(struct irq_data *d) 67 75 { 68 76 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); ··· 80 72 if (!(g->irq_edge & BIT(d->hwirq))) 81 73 ixp4xx_gpio_irq_ack(d); 82 74 75 + gpiochip_enable_irq(gc, d->hwirq); 83 76 irq_chip_unmask_parent(d); 84 77 } 85 78 ··· 158 149 return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH); 159 150 } 160 151 161 - static struct irq_chip ixp4xx_gpio_irqchip = { 152 + static const struct irq_chip ixp4xx_gpio_irqchip = { 162 153 .name = "IXP4GPIO", 163 154 .irq_ack = ixp4xx_gpio_irq_ack, 164 - .irq_mask = irq_chip_mask_parent, 155 + .irq_mask = ixp4xx_gpio_mask_irq, 165 156 .irq_unmask = ixp4xx_gpio_irq_unmask, 166 157 .irq_set_type = ixp4xx_gpio_irq_set_type, 158 + .flags = IRQCHIP_IMMUTABLE, 159 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 167 160 }; 168 161 169 162 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, ··· 274 263 g->gc.owner = THIS_MODULE; 275 264 276 265 girq = &g->gc.irq; 277 - girq->chip = &ixp4xx_gpio_irqchip; 266 + gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip); 278 267 girq->fwnode = g->fwnode; 279 268 girq->parent_domain = parent; 280 269 girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq;